RobertP Posted June 18, 2012 Share Posted June 18, 2012 http://jsfiddle.net/AwzVJ/ i need to get the id of the closest div. in my example i need to get the id fr=or div#context :S Link to comment https://forums.phpfreaks.com/topic/264360-jquery-get-closest-divs-id/ Share on other sites More sharing options...
requinix Posted June 18, 2012 Share Posted June 18, 2012 It's funny that you say "closest". Link to comment https://forums.phpfreaks.com/topic/264360-jquery-get-closest-divs-id/#findComment-1354765 Share on other sites More sharing options...
RobertP Posted June 18, 2012 Author Share Posted June 18, 2012 http://jsfiddle.net/AwzVJ/ $(window).ready(function(){ $("span#console").html("Loaded"); $("html").mousedown(function(e){ $("span#console").html("id="+$(this).closest("div").attr("id")); }); }); Link to comment https://forums.phpfreaks.com/topic/264360-jquery-get-closest-divs-id/#findComment-1354767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.