Can we write multiple css style in single line in JQuery
$('.ui-dialog').css("left","475px");
$('.ui-dialog').css("top","215px");
Does we can write this to single line like below
$('.ui-dialog').css("'left','475px'","'top','215px'"); // Test
Yes you can. The jQuery .css() method also accepts a map. Check their documentation for more examples.
$('.ui-dialog').css({
'left' : '475px',
'top' : '215px'
});
You can pass an object with the key as the property and the value as what you may expect.
$('.ui-dialog').css({
left: 475,
top: 215
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With