Reputation: 21907
I'm trying to modify the width of a div. What am I doing wrong?
$('#foo')
[<div class="bar" id="foo" style="width: 40%"></div>]
$('#foo').css('style','width:50%')
[<div class="bar" id="foo" style="width: 40%"></div>]
Upvotes: 2
Views: 5592
Reputation: 4458
Actually you can follow either one of the following two methods.
$('#foo').css('width','50%')
Or
$('#foo').css({width:'50%'})
The second method is used to change multiple properties at one.
Upvotes: 6