How would you write the Jquery to get the closest div that actually has an ID defined?
You should use has attribute selector. This sample should do the work:
$('selector').closest('[id]')
$(elementToStart).parent().closest('div[id]');
I use the parent() to avoid just getting the element itself.
Example: http://jsfiddle.net/zQRFT/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With