Sunday, 11 August 2013
Change text color on button click
Today i show Change text color on button click event using jQuery . You can implement this on asp,html etc
Full Code:
<html>
<head>
<title>jQuery color change</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>
<body>
<p><h1>Dreamthewebs.blogspot.com</h1></p>
<button id="color" > Change color</button>
<script>
$(document).ready(function()
{
//change color
$("h1").css({"color":"red" });
$("#color").click( function()
{
$("h1").css({"color":"blue" });
});
});
</script>
</body>
</html>
Demo
Full Code:
<html>
<head>
<title>jQuery color change</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>
<body>
<p><h1>Dreamthewebs.blogspot.com</h1></p>
<button id="color" > Change color</button>
<script>
$(document).ready(function()
{
//change color
$("h1").css({"color":"red" });
$("#color").click( function()
{
$("h1").css({"color":"blue" });
});
});
</script>
</body>
</html>
Demo
0 comments:
Post a Comment