Sunday, December 27, 2015

How to bind image in Body tag in jquery or for loop in jquery

<html>
  <head>
    <meta charset="utf-8">
      <title>tes</title>
  </head>
  <body>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'></script>
    <script>
var image = $("<img>")
        .attr('src', 'peakcock.jpg')
        .attr('width', '10')
for(i = 0, i < 5, i++) {
            $(image).appendTo('body');  
        }
    </script>
  </body>
</html>

No comments:

Post a Comment