Reputation: 1057
Is it possible to change the value of width below using jQuery
<div style="width:75%" id="twitter" class="bar"></div>
<div style="width:75%" id="other2" class="bar"></div>
<div style="width:75%" id="something" class="bar"></div>
I have tried
jQuery(document).ready(function($) {
$('#twitter').css({
"width":"5%",
});
)};
Here is my jsfiddle
http://jsfiddle.net/LSwwB/1/
Thanks
Upvotes: 0
Views: 62
Reputation: 206467
jQuery(function($) {
$('#twitter').css({width:"5%"}); // <-- extra ','
}); // <-- instead of mustache add a beard to that fella
Upvotes: 0
Reputation: 18891
You had a couple errors in your code. Fixed on http://jsfiddle.net/LSwwB/3/.
Line 3: no comma after the last property.
Line 5: )};
should be });
Upvotes: 3
Reputation: 61079
That should work fine (with the syntax fixes posted by others). Slighly simpler is jQuery's Width function: http://api.jquery.com/width/#width2
$('#twitter').width('5%');
Upvotes: 0