I currently have an href that I’d like to pull text from. Unfortunately I don’t have access to to code, and the limited code I have to work with is the following:
<div id="myDiv">
<h1 class="myClass">
<a href="link">TEXT</a>
</h1>
</div>
I’d prefer using JavaScript to obtain this information. What would be the best way to reference ‘TEXT’? I’ve tried a couple methods using getElementById and getElementsByClassName, but each have proven unsuccessful. Thanks!
Live DEMO
If you can use jQuery…: