class - Set width with jQuery for Flot Chart -


i want set width in jquery chart i've used on page. i've set width in stylesheet using class .sparkline-width. how can call class in jquery?

html

<div id="sparkline-1" class="sparkline sparkline-width"></div> 

jquery

$("#sparkline-1, #sparkline-3, #sparkline-5").sparkline([5,6,7,9,9,5,3,2,2,4,6,7], {    type: 'line',    spotcolor: '#990000',    minspotcolor: '#990000',    maxspotcolor: '#990000',    width:     height: '25px', }); 

you can use width():

$('.sparkline-width').width("your width here"); 

based on comment, can add new class element:

$("p").addclass("newclass"); 

then refer in css:

.newclass {     /* styles here */ } 

Comments