Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
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

 Answers
4

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.


[#86857] Tuesday, March 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zainsagez

Total Points: 555
Total Questions: 99
Total Answers: 96

Location: Honduras
Member since Sat, Jul 24, 2021
3 Years ago
;