I have a form with some inputs and selects. I want to get the type of element on its click with jQuery. I know I can use attr("input") to get if the element is radio, checkbox or text but what about selects and textarea?
Is there a overall function like .type() to get it?
You can use
:inputto select all input elements.You could try something such as…
For
inputelements, this should give you theirtypeattribute, such astext,radio,checkbox, etc.For
selectandtextareaelements, it should give you the tag name such asselectortextarea.