Replace Class - Jquery

How to replace class in jquery

Snippet Code


  
Rate this page :
  [ 0 votes]

Here the class "demo" is removed using removeclass function.

$(document).ready(function(){ $("#test").removeClass('demo').addClass('replace');//To replace "replace" class with "demo" to <div> tag. }); <div id='test' class='demo'>Welcome to hiox</div> <style> .demo{font-weight:bold;font-size:1.2em;color:red;font-style:italic;} .replace{font-weight:normal;color:blue;font-style:normal;} </style>

Tags


Ask Questions

Ask Question