javascript - JQuery enabling button if all checkboxes are selected and add css to disabled button -



javascript - JQuery enabling button if all checkboxes are selected and add css to disabled button -

i trying enable button if checkboxes selected , disable if unselected. have achived using code:

checkboxes.change(function() { submitbutton.attr("disabled", checkboxes.is(":not(:checked)")); });

what not sure how add together , remove css class if button enabled or disabled.

example here: jsfiddle

any help appreciated.

posting comment reply now...

var checkboxes = $('input.compulsory'), submitbutton = $('#continue'); checkboxes.change(function () { submitbutton.attr("disabled", checkboxes.is(":not(:checked)")); if(checkboxes.is(":not(:checked)")) { submitbutton.addclass('disabled'); } else { submitbutton.removeclass('disabled'); } });

demo here

javascript jquery html css

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -