Apply/change css using jquery

We use css for styling html elemnets but we can use jquery as well to apply different styles to html elements. Jquery has method .css in which we can set different style for html elements.

<input type="button" value="Change my color" onclick="ChangeColor()" id="btnColor" />

<script type="text/javascript">
    function ChangeColor() {
        $("#btnColor").css("color", "blue");                //For applying single style
        $("#btnColor").css({ "color": "blue", "font-size": "10px" });        //For applying multipl styles
    }

</script>

Comments

Popular posts from this blog

Check if ViewBag is null or doesn't exist

Using Progress Bar In C#

Jquery serer side datatables in asp.net