I have a submit button which has a color red css style by default. How can I apply a css styling on it on the fly and seeing the result without refreshing the page using jquery?
I have an oncheck query and I want to put the code that will change styling above the return true;
My button
<input type="submit" name="submit" id="submitForm" class="btn btn-primary-alt" value="Submit" onsubmit="return validate_age();" />
The css styling I want to apply on my submit button
.btn-primary-alt:hover {
background-color: #3b8410;
border-bottom: 3px solid #2a620a;
border-color: #2a620a;
color: #fff;
}
My jquery
if($("#age_18").is(":checked"))
{
// This is where I want the css styling will happen.
return true;
}
else
{
alert("You must be above 18 years of age.");
return false;
}
So basically when my checkbox is checked I want to add a css styling on my submit button. thanks
return truein the very next line the page will go to the new page before the changed CSS is visible. Do you wish to prevent the page-reload as well as style the check-box; or do you want the changed CSS to be visible and then reload the page (or go to the next page, etc...)?