get image from div when click on it - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

get image from div when click on it

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> 
 </head> //from  w  w w.  jav  a  2 s  .  co m
 <body> 
  <div class="click"> 
   <img class="img1" src="http://www.java2s.com/style/demo/Firefox.png"> 
  </div> 
  <div class="click"> 
   <img class="img2" src="http://www.java2s.com/style/demo/Safari.png"> 
  </div> 
  <div class="content"></div> 
  <script>
$('.click').click(function() {
  $('.content').html($(this).find('img').clone());
});

      </script>  
 </body>
</html>

Related Tutorials