Javascript examples for DOM HTML Element:Span
Get text value from <span>
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w. j a v a2 s . com var x = document.getElementById('pids').innerText; var y = JSON.parse(x); console.log(y.length); } </script> </head> <body> <span id="pids" style="display:none">["26551826","22956811","22959266"]</span> </body> </html>