Copy events from child elements to different div - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:live

Description

Copy events from child elements to different div

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
  <script type="text/javascript">
    $(function(){//www.ja  v  a 2 s  .c  o m
$("a").live("click",function() {
   console.log("click");
});

$('#newDiv').html($('#oldDiv').html());
    });

      </script> 
 </head> 
 <body> 
  <div id="newDiv"></div> 
  <div id="oldDiv"> 
   <a>click me</a> 
  </div>  
 </body>
</html>

Related Tutorials