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 element
refers to the whole object, you can't just compare it to select
with a comparison operator ==
.
Simply use the .is()
method for this...
if ( element.is('select') ) { ....