Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to give css in jquery in Jquery functions of JQuery Examples
2271 Views
Hints 
css() function used to apply styles to an elements.

Example 1: Single styles applied to an element.
Syntax: $("element").css("color","white");

Example 2: mutiple styles applied to an element.
Syntax: $("element").css({"color":"white","font-size":"12px");
Example 1: Single styles applied to an element
<html>

<head>
    <title>HTML-JQuery</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

    <script type="text/javascript">
        $(function () {
            $(".element").css("color", "red");
        });
    </script>

</head>

<body>
    <div class="element">hello</div>
</body>

</html>
Demo Example :1  
Example 2: mutiple styles applied to an element
<html>

<head>
    <title>HTML-JQuery</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

    <script type="text/javascript">
        $(function () {
            $(".element").css({
                "color": "red",
                "font-size": "30px"
            });
        });
    </script>

</head>

<body>
    <div class="element">hello</div>
</body>

</html>
Demo Example : 2 
Best Lessons of "JQuery Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details