Quantcast
Channel: Using Jquery to get the div id? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Nick Craver for Using Jquery to get the div id?

Use .closest(selector) to crawl up to that parent, like this:$("#some_id").click(function() { var test = $(this).closest('.first').attr('id'); alert(test); return false;});You can give it a try here....

View Article



Using Jquery to get the div id?

How can I get DIV id or DIV class using Jquery if the HTML is similar to:<div class="first" id="first_id"><div class="second">text sample</div><div class="third"><button...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>