Jump to content

[SOLVED] getElementsByTagName('a')[0]; not working? please help.


sayedsohail

Recommended Posts

Hi everyone,

 

I wrote  function to select <a> value into the var using javascript.  but it doesn't work.

 

Here is my code.

HTML

<ul id="tabnavigation">
<li><a href="#">Help</a>
<li><a href="#">Check</a>
</ul>


<script>
function selectalert(acss)
{
if (!acss){
	var pcss=document.getElementById('tabnavigation').getElementsByTagName('a')[0];
	alert(pcss);}
}


window.onload=selectalert("")
</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.