Reputation: 13988
I am trying to apply width for my divisions using jquery. The following code is working fine for me.
$('#bodycontainer').css('width','300px');
$('#footer').css('width','300px');
But when combine both id's and keep it as a single rule is not working. see below.
$('#bodycontainer','#footer').css('width','300px');
What i am doing wrong here??
Upvotes: 2
Views: 67
Reputation: 67187
The way you have used the multiple selector is wrong
Try,
$('#bodycontainer,#footer').css('width','300px');
Upvotes: 5
Reputation: 74738
you have to use this way:
$('#bodycontainer, #footer').css('width','300px');
Here you have selected multiple selectors with ,
separated in a single string.
$('#bodycontainer','#footer')
Using this way is says that find me #bodycontainer
in #footer
. The second one is treated as a context.
so what that mean is this:
$('#bodycontainer','#footer') === $('#footer').find('#bodycontainer')
Both are equal to this.
Upvotes: 1