javascript

jQuery element's tag name

22/05/2013

Getting the selected element’s tag name is very easy in jQuery. Just use the below code.

$(el).prop("tagName");

Keep in mind that by default the returned tag’s name is capitalized so if you want it lowercase you’ll need this:

$(el).prop("tagName").toLowerCase();