I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html().
$("[id$=" + endOfIdToMatch + "]").each(function () { //determine whether $(this) is a textbox or label //do stuff });
I found a solution that doesn't work, it just returns "undefined":
$("[id$=" + endOfIdToMatch + "]").each(function () { alert($(this).tagName); });
What am I missing?
Just one jQuery too much:
$("[id$=" + endOfIdToMatch + "]").each(function () { alert(this.tagName); });
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