javascript - HTML div value not showing -
i have variable when show in alert shows values 1 when assign value div not show value on page.
<html> <head> <script src="jquery-1.6.2.min.js"></script> <script > var ad = ['a', 'b', 'c', 'a', 'd', 'e', 'a']; var con=document.getelementbyid('data'); var inds = $.map(ad, function(v, i) { //$("data").html(v); return v == 'b' ? : null; }); //con.innerhtml=inds; alert(inds); // 0,3,6 var avr1=inds; con.innerhtml=avr1; </script> </head> <body> <div id="data"></div> </body> </html>
<html> <head> <script src="jquery-1.6.2.min.js"></script> </head> <body> <div id="data"></div> <script> var ad = ['a', 'b', 'c', 'a', 'd', 'e', 'a']; var con=document.getelementbyid('data'); var inds = $.map(ad, function(v, i) { return v == 'b' ? : null; }); alert(inds); // 0,3,6 var avr1=inds; con.innerhtml=avr1; </script> </body> </html>
Comments
Post a Comment