jQuery provides .css() method to get and set the various CSS properties for the element. This method can be used to set one or multiple CSS properties for any element. You can also get the CSS property value using this method. In this post, I will show you all the 3 operations.
Set single CSS Property
Feel free to contact me for any help related to jQuery, I will gladly help you.
Set single CSS Property
//Code StartsSet multiple CSS Properties
$("p").css("background-color", "LightGrey");
//Code Ends
//Code StartsGet value of CSS Property
$("span").css({"background-color": "Green","color":"Yellow"});
//Code Ends
//Code StartsSee result below.
$("div").html($('span' ).css("font-size"));
//Code Ends
Feel free to contact me for any help related to jQuery, I will gladly help you.
Aucun commentaire:
Enregistrer un commentaire