javascript - Enable button when checkboxes selected -
I have more than one checkbox and a submit button that is initially disabled. When checking a box, the button is enabled and when unchecked, the button is again disabled.
If multiple checkboxes are selected but uncheck one, then the button is disabled even if I have selected other checkboxes. How can I fix this problem?
  & lt; Script type = "text / javascript" & gt; $ (Function () {$ ("checkbox"). (Function () {$ ("delete."). Et ("disabled",! This.checked);});}); & Lt; / Script & gt;    HTML  
  & lt; Input type = "checkbox" name = "msg []" value = "32" square = "checkbox" /> & Lt; Input type = "checkbox" name = "msg []" value = "44" class = "checkbox" /> & Lt; Input type = "checkbox" name = "msg []" value = "26" square = "checkbox" /> & Lt; Button type = "submit" class = "delete" disabled = "disabled" & gt; Remove & lt; / Button & gt;     
   $ (function () {$ (". ('' Disabled '', '$' ('input.checkbox: checked'). Length == 0);});}) Click on (function () ($. '   Demo:   
 
  
Comments
Post a Comment