Let us say I have in HTML:
<input name="something" id="someid" />
And then in Jquery, I want to click on some element and after I click I want to get the tag name of the element.
So this.getTheTagName.
Everything I tried so far does not really work, especially for input tag.
You probably mean the
nameattribute and not the tag name.If you did mean the tag name, use
.prop('tagName'):Here’s an example for both: http://jsfiddle.net/wwQ7h/