Codepedia
.info
Home
About
Demos
Tools
SVG Wave Generator
Colors
Edit This Code :
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </head> <body> <button id="btnClick">Click ME</button><br/> <br/> <div id="dvContent"></div> <script type="text/javascript"> $(document).ready(function(){ $("#btnClick").on('click',function(e){ var fragment=""; // here's my array variable var myArray = ["apple", "mango", "orange", "grapes", "banana"]; $.each(myArray, function (index, value) { var getData=index+' : '+value; console.log(getData); fragment +=getData +'<br/>'; }); $("#dvContent").html(fragment); }); }); </script> </body> </html>
➤ Run / View
Result :