Given the list of HTML inputs, text fields, and selections, I would like to check and see if there is a name attribute equal to the given string, and if necessary add a class to it.
For example:
if($('textarea, input, select').attr("name") == "this_name"){ $(this).addClass("myClass"); }
I'm just not sure what I'm doing wrong here, but it doesn't seem to be working.
jquery
kylex
source share