HOME

Wednesday, November 25, 2015

JQUERY PROGRAM TO CHANGE COLOR OF TEXT WHEN USER CLICK ON BUTTON

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$("#id1").click(function()
{
$(".cl1").css("color","blue");
});
$("#id2").click(function()
{
$(".cl1").css("color","green");
});
$("#id3").click(function()
{
$(".cl1").css("color","red");
});
});
</script>
<body><p class="cl1">
<span style="border: 5px groove cyan"> Click on button to change my color</span>
</p><br>
<br>
<button id="id1">Blue</button>
<button id="id2">Green</button>
<button id="id3">Red</button>
</body>
</html>

No comments:

Post a Comment