Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function () { $("button").click(function () { //get style property value var color = $("div").css('color'); alert('div color is ' + color); //set style property $("p").css({ 'color': 'green', 'font-size': '25px' }); }); }); </script> </head> <body> <h1>jQuery Manipulation Methods: css()</h1> <div style="color:green">This is div.</div> <p>This is a paragraph.</p> <button>Click Here to test css()</button> </body> </html>
Result: