jquery - how get target children id -
short english...
my html
<button><span id="popmain"> pop </span></button> $(document).bind({ click : function(evt){ var targetid = evt.target.id; var nodename = evt.target.nodename; }
- click event chrome ( nodename : span )
- click event explorer (nodename : button)
when use explorer, want span's id.
i try
$(this).find('span').attr('id'); $(this).find('span').id; $("#"+evt.target.id).children('span').attr('id'); $("#"+evt.target.id).find('span:first-child').attr('id'); $("#"+evt.target.id).find('span:last-child').attr('id');
but result 'undifined'. t^t plz me...
spelling mistake:
$(this).find('span').attr('id'); $(this).find('span').id; $("#"+evt.target.id).childeren('span').attr('id'); // children not childeren. $("#"+evt.target.id).find('span:first-child').attr('id'); $("#"+evt.target.id).find('span:last-child').attr('id');
Comments
Post a Comment