Hello,
I am trying to get the innerHTML of a specific a tag's href on my page.
The a tag has a unique css class
<a class="myClass" href="myURL">
I'd like to do something like this
<script language="javascript">
function hello(){
var foo = document.getElementsByTagName("myClass")[0];
if (foo) alert(foo.innerHTML);
}
</script>
I guess this question has two parts:
Is it possible to use getElementByTagName to access the innerHTML of a css class?
Is it possible to get a specific attribute of said css class and access it's innerHTML?
If it is then any pointers or links to examples would be very much appreciated.
Thanks
I am trying to get the innerHTML of a specific a tag's href on my page.
The a tag has a unique css class
<a class="myClass" href="myURL">
I'd like to do something like this
<script language="javascript">
function hello(){
var foo = document.getElementsByTagName("myClass")[0];
if (foo) alert(foo.innerHTML);
}
</script>
I guess this question has two parts:
Is it possible to use getElementByTagName to access the innerHTML of a css class?
Is it possible to get a specific attribute of said css class and access it's innerHTML?
If it is then any pointers or links to examples would be very much appreciated.
Thanks