I’m rewriting some code that works into code that’s currently not working. Basically, I loop through divs to find out which one is visible and I want to continue by caching this div into a jquery object.
$('#MainDiv .LPanel').each(function () {
if ($(this).is(':visible') === true) {
var ThePanel = $(this);
}
});
if (ThePanel.width() < 700) { // bugs here
Why is ThePanel not accessible?? What am I missing?
Thanks for your suggestions.
PS: the code that works just returns attr('id'); but I want the whole object!
You use
varin a limited scope. The correct approach is:Why don’t you do just
???