I have a Bootstrap 4 button on my html webpage. w3schools (https://www.w3schools.com/bootstrap4/bootstrap_buttons.asp) says that including a button the following way will have it appear disabled, i.e. unclickable.
<button type="button" class="btn btn-primary" disabled>Disabled Primary</button>
I'd like to set up the button's form so that when it's clicked, it becomes disabled. Here is the relevant portion of what I have so far:
$(document).on('submit', '.Validate', function(e){
e.preventDefault();
var form = $( this );
form.attr('disabled')
$.ajax({
type:'POST',
url:'/workflowautomator/setready/',
data:{
name: (form.find('input[class="name"]')).val()
},
success:function(){
form.removeAttr('disabled')
}
});
});
However, the usage I see for .attr is more like
$( "#greatphoto" ).attr( "title", "Photo by Kelly Clark" );
where there is a name for the attribute and a value, instead of up above, where the word "disabled" is alone in the button start tag. Is the "disabled" word not actually a proper attribute? w3schools describes it as such. How might I make this code work?