Friday, February 17, 2012

how to add and remove class using jquery

Add Remove Class using jquery Name :





 <script>
function addcls(){

 $("#name").attr("class","classname1 classname2");  
}

function removeclass(){
$("#name").removeAttr("class")
}
</script>

Name :
<input type="text" name="name" id="name" value="my name" onclick="(this.value='')" /><br />

<input type="button" onclick="addcls()" value="Add Class"  />
<input type="button" onclick="removeclass()" value="Remove Class"  />


No comments:

Post a Comment

If you Satisfied , Please Leave a comment