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
  • 125
  • 1
  • 2
  • 10

1 Answers1

0
$("#test").on('click',  function() {
       $("#body").html("<a href='#' id='removeclass'>removeclass</a>"); 
}); 
$("#removeclass").live('click',  function() {
        $("#test").removeClass("anClass"); 
}); 
Manish Kumar
  • 9,824
  • 21
  • 74
  • 137