Possible Duplicate:
Get element type with jQuery
Preamble: I'm Italian, sorry for my bad English.
From an html code like this:
<input class="myElem" />
<input class="myElem" />
<div class="myElem"></div>
<ul class="myElem"></ul>
<input class="myElem" />
is there a way to retrieve the html objects type?
something like:
$('.myElem').each(function () {
var htmlType = $(this).type() //Example
console.log(htmlType);
});
/* Log:
* input
* input
* div
* ul
* input
*/
$('.myElem').each(function () {
var htmlType = $(this).prop('tagName') //Example
console.log(htmlType);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With