Class change using JavaScript.

Change class name using JavaScript.
[sourcecode language=”plain”]
<Html>
<head>
<style>
.intro
{
color:green;
background-color:blue;

}
</style>
</head>
<body>

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert("hello")
});

function fun1()
{

$(‘p’).addClass(‘intro’);

}

function fun2()
{

$(‘p’).removeClass(‘intro’);

}

function fun3()
{

$(‘p’).toggleClass(‘intro’);

}
</script>
<p>Hello</p>
<input type="button" onclick="fun1()" value="pune1">
<input type="button" onclick="fun2()" value="pune2">
<input type="button" onclick="fun3()" value="pune3">
</body>
</html>
[/sourcecode]

Leave a Reply