Showing posts with label change the text color of the paragraph when you click on the button. Show all posts
Showing posts with label change the text color of the paragraph when you click on the button. Show all posts

Sunday, December 25, 2011

change the text color of the paragraph when you click on the button


Example : change the text color of the paragraph when you click on the button

<html>
<head>
<title> css function</title>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").css("color", "red");
});
});
</script>
</head>

<body>
<center>
<h2>change the text color of the paragraph when you click on the button.</h2>
<p>[I am a paragraph. when you click on the button, my text color will be change.] </p>
<button>Click me</button>
</center>
</body>
</html>