142
rated 0 times
[
145]
[
3]
/ answers: 1 / hits: 109202
/ 12 Years ago, wed, march 14, 2012, 12:00:00
I found this in a jQuery file:
xxx.css({ 'float' : 'right' });
What do the curly braces do?
More From » jquery
I found this in a jQuery file:
xxx.css({ 'float' : 'right' });
What do the curly braces do?
In your case it is an object passed to your css function.
myObj={} // a blank object
Here you can use this too
myObj={'float' : 'right'}
xxx.css(myObj);
Here is another example of object
var myObj={
'varOne':'One',
'methodOne':function(){ alert('methodOne has been called!')}
}
myObj.methodOne(); // It will alert 'methodOne has been called!'
A fiddle is here.