javascript - return null document.getElementsByTagName -
ihave simple ul element in webpage :
<div id="jqueryftd_demo" class="demo"><ul class="jqueryfiletree" style=""> <li class="directory collapsed"><a href="#" rel="/samplefolder/a/">a</a></li> <li class="directory collapsed"><a href="#" rel="/samplefolder/b/">b</a></li> <li class="directory collapsed"><a href="#" rel="/samplefolder/c/">c</a></li> <li class="directory collapsed"><a href="#" rel="/samplefolder/d/">d</a></li> <li class="file ext_accdb"><a href="#" rel="/samplefolder/sampledbfile.accdb">sampledbfile.accdb</a></li> <li class="file ext_txt"><a href="#" rel="/samplefolder/sometext.txt">sometext.txt</a></li> </ul></div>
and try find tags in javascript :
var x = document.getelementsbytagname("a"); return x.textcontent;
my return value null, please me?
thanks.
issue pretty simple ... getelementsbytagname returns collection array like.
you have iterate collection interact properties of each element instance
Comments
Post a Comment