0

I want that class remove from an element, when click on a link, that created with jquery html function

here is an example:

//script
  $("#test").click(function(){
       $("#body").html("<a href='#' id='removeclass'>removeclass</a>"); 
    });
   $("#removeclass").click(function(){
      $("#test").removeClass("anClass"); 
    });

//html

<div id="body"></div>
<button id="test" class="anClass">Test</button>
harry34
  • 135
  • 1
  • 2
  • 11

1 Answers1

0
$("#test").on('click',  function() {
       $("#body").html("<a href='#' id='removeclass'>removeclass</a>"); 
}); 
$("#removeclass").live('click',  function() {
        $("#test").removeClass("anClass"); 
}); 
Manish Kumar
  • 10,214
  • 25
  • 77
  • 147