Reputation: 59
How can I get "Test2" using JavaScript?
Here is my HTML:
<table>
<th> </th>
<tr id = "123">
<td>
<UL>
<Li> Test1 </Li>
<Li> <a class ="SomeClass" >Test2 <a/> </Li>
</UL>
</td>
</tr>
</table>
Upvotes: 0
Views: 74
Reputation: 3574
Try the following JavaScript code to do it.
var example = document.getElementById('test2').innerHTML;
alert(example);
<table>
<th></th>
<tr id="123">
<td>
<UL>
<Li>Test1</Li>
<Li> <a class="SomeClass" id="test2">Test2 <a/> </Li>
</UL>
</td>
</tr>
</table>
Upvotes: 0