Reputation: 383
My need is very simple and I am not getting any way yet. I have JQuery object 'node' which contains div id. When I write below code:-
alert($(node).get(0).innerHTML)
I get result as following:-
<div><span id="spn_148">ABC</span></div>
I only want to get span id i.e "spn_148" from innerHTML of $(node). Please help me out
Upvotes: 1
Views: 881
Reputation: 193261
You can get span
id like this:
$(node).find('span')[0].id
Bracket [0]
is the equivalent to .get(0)
in your example, just shorter. So the idea is to find span
element withing node
and get its id
property.
Upvotes: 2