I have CSS for a submit button (shortened for ease of reading):
input[type="submit"]
{
background-color:#3bb3e0;
padding:10px;
position:relative;
font-family: Arial, sans-serif;
font-size:12px;
text-decoration:none;
color:#fff;
border: solid 1px #186f8f;
border-radius: 5px;
cursor:pointer;
}
When a user if filling out a form, whilst error checking using ajax I want to disable the submit button and change its color if the user enters something wrong, so I use the following jquery:
if(response == 0)
{
$("#button").addClass("buttonDisable");
$('#cross').fadeIn();
$('#button').prop('disabled', true);
}
The button disables ok but the CSS has no effect as the inspector shows it added after the initial css therefore it is crossed out:
input[type="submit"].buttonDisable { background-color:#ccc; border:1px solid #666; }
QUESTION: How can I make the class have an effect on the button?
fashion.stackexchange.comif it existed :)Changing style doesn't add class