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

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

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -

asp.net - call stack missing info on mono with apache and mod_mono -