1

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.

Pramod
  • 2,644
  • 6
  • 27
  • 39
  • 1
    Possible duplicate of http://stackoverflow.com/questions/178325/testing-if-something-is-hidden-with-jquery – palaѕн Jan 03 '13 at 09:45

3 Answers3

3

try this

     if($('label:visible').length)
      {
          //disable the submit button here
      }
YogeshWaran
  • 2,191
  • 1
  • 22
  • 32
1

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

if($('label:visible').length)..
bipen
  • 34,730
  • 9
  • 44
  • 61
1

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

Sapan Diwakar
  • 9,252
  • 4
  • 30
  • 43