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
Post a Comment