Reputation: 59634
I have some CCS defined as following:
.FW_Buttons {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background-color: #123456;
}
and I want to add it to a button defined like this:
<div id="but_begin"><button type="button" id="but2_begin">Go</button></div>
using JQuery (in document-ready):
$("#but2_begin").css("FW_Buttons");
but the css is not applied on the button. I have checked with FireBug: it is not there. No error is triggered when using a breakpoint.
What am I doing wrong? Thanks.
Upvotes: 0
Views: 9031
Reputation: 40511
$("#but2_begin").addClass("FW_Buttons");
You want to use addClass()
not css()
.
Upvotes: 5
Reputation: 1968
.css is used to set/get css elements, in order to set a class you can use .addClass()
$("#but2_begin").addClass("FW_Buttons");
Make sure to take a look at other methods to deal with css classes, they may be usefull for you in the future:
.removeClass()
.toggleClass()
.addClass()
.hasClass()
Upvotes: 4