I have a jquery toggling menu with password fields. By default, the submit button is disabled, and enabled on keyup events.
$(function(){
$("#submitProfile").attr("disabled","true");
$("#password_confirmation, #password, #current_password").keyup(function(){
$("#submitProfile").removeAttr("disabled");
});
});
But how can I keep the button disabled until all the fields are filled?
You can add a condition.
$(function(){
$("#submitProfile").attr("disabled","true");
$("#password_confirmation, #password, #current_password").keyup(function(){
if($("#password_confirmation").val() && $("#password").val() && $("#current_password").val())
$("#submitProfile").removeAttr("disabled");
});
});
You can try something like this:-
if($('#password_confirmation, #password, #current_password').val().length>0){
$("#submitProfile").removeAttr("disabled");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.