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

Date: 2014jan24 Librarylatform: jQuery Language: javaScript Q. jQuery: find out what kind of tag something is. eg checkbox, select, button, etc. A.
const tag = $('#mything').prop('tagName').toLowerCase();
In older jQuery, you need 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.