Pramod
Pramod

Reputation: 2896

find element is hidden or not

I have some labels on my html page, I use them for validation errors, If all the input data is right then I hide those labels, and if not, showing accordingly. I want, if any of the label is shown then, disable the submit button.

Upvotes: 1

Views: 184

Answers (3)

Sapan Diwakar
Sapan Diwakar

Reputation: 10946

You can use jQuery .is(":visible") to find if an element is visible.

Upvotes: 1

bipen
bipen

Reputation: 36531

try :visible to check if it is not hidden and length() to count the elements

if($('label:visible').length)..

Upvotes: 1

YogeshWaran
YogeshWaran

Reputation: 2281

try this

     if($('label:visible').length)
      {
          //disable the submit button here
      }

Upvotes: 3

Related Questions