If I had an input of type "radio", I would target it like this:
if (element.attr("type") == "radio")
How do you target a select box? I've tried:
if (element == "select")
but that doesn't work. I know it's got to be something simple, but I just don't know the syntax.
Since
elementrefers to the whole object, you can't just compare it toselectwith a comparison operator==.Simply use the
.is()method for this...DEMO: http://jsfiddle.net/18xogtk3/