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 Quote 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". Quote 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")); }); }); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.