jquery - How to check what div span is placed in -


i trying find out div span in using jquery.

here eg.

 <div id='one'></div>  <div id='two'></div>  <div id='three'><span id="find_me"></span></div> 

thanks

use .closest() find closest ancestor div (.parent() find it if div immediate parent).

$('#find_me').closest('div').attr('id') 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -