سؤال

I have a RadTreeView with a custom NodeTemplate. Inside that node template, I have the node surrounded in a div, like so:

<div id="divCommandRow">
    <!-- My template goes here -->
</div>

After the RadTreeView renders, my DOM has several <div id="divCommandRow"> divs in the DOM. My question is, how can I use jQuery to query if any of these div's have display: none style? I created the following code, but it doesn't seem to work:

    function IsInEditMode() {
        $('#divCommandRow').each(function () {
            if ($(this).is(':visible'))
                return true;
        });
        return false;
    }

Any ideas on what I'm doing wrong?

هل كانت مفيدة؟

المحلول

$('selector').length == $('selector:visible').length

or

$('selector:not(:visible)').length == 0

With this condition you check if all the elements that match selector selector are visible

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top