<html> <head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div").click(function () { var color = $(this).css("background-color"); alert(color); }); }); </script> </head> <body> <body> <div style="background-color:blue;">asdf</div> </body> </html>
30.29.css function | ||||
30.29.1. | Add border to DIV | |||
30.29.2. | Add paragraph and set the style | |||
30.29.3. | Define CSS in an array and set | |||
30.29.4. | Get CSS value | |||
30.29.5. | Set two CSS value in CSS function | |||
30.29.6. | Nested style setting | |||
30.29.7. | Use the rgb function with JQuery | |||
30.29.8. | Use CSS value when creating new tag | |||
30.29.9. | The basic CSS Selectors supported by jQuery | |||
30.29.10. | css(name): Return a style property on the matched element. | |||
30.29.11. | css(properties): set several style properties on matched elements. | |||
30.29.12. | css(name, value): If a number is provided, it is automatically converted into a pixel value. | |||
30.29.13. | Adds a background and text color to all the headers on the page. | |||
30.29.14. | Sets the background color of the page to black. |