suannai suannai - 1 year ago 99
Javascript Question

How to get < span > value?

There are a piece of code,but can not use


So,how do I get to the
<span> 1 2 3 4

<div id="test">

Answer Source

Try this

var div = document.getElementById("test");
var spans = div.getElementsByTagName("span");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download