Programming Tips - jQuery: find out what kind of tag something is.

Date: 2014jan24 Library: jQuery Language: javaScript Keywords: tagType Q. jQuery: find out what kind of tag something is. eg checkbox, select, button, etc. A.
const tag = $('#mything').prop('tagName').toLowerCase(); // BETTER
In older jQuery, you needed to use raw DOM:
const tag = $('#mything')[0].tagName.toLowerCase(); console.log('mything is a ' + tag);
The [0] converts your query into a DOM object so you can use .tagName. Some browser give it in UPPERCASE so I like to convert it to lower.