How do I add a css class to an Div element in JQuery? I have a DIV with a css class and the div contains a form. After clicking on submit I want the original css class to disapp
To add a class, use addClass:
$('#myDiv').addClass("blah");
So upon your submit you can do something like:
$('#submit').click(function() {
$('#myDiv').removeClass().addClass("blah");
});
Calling removeClass with no parameters removes all classes linked to that element. Alternatively, you can call removeAttr("style")