jquery adding new class configuration on id?
<area shape="poly" coords="63,10,64,38,89,37,91,10" class={"strokeColor:'0000ff',strokeWidth:5, fillColor:'ff0000',fillOpacity:0.6}" href="#" id="x1"&开发者_如何学JAVAgt;
There is a imagemap in my html and I want to dynamicly add a new configuration "alwaysOn:true" to the class attribute.
I cannot figure out how to add config option How can I do that with jquery?
Look into jquery attributes.
You need something along the lines of . . .
$("#x1").click(function(){
var oldClass = $(this).attr("class");
$(this).attr("class", oldClass + ' alwaysOn:true');
});
精彩评论