Hi,

I need to pass the value of hyperlink to another jsp page.

For eg.,

<a href="sample.html" id="myAnchor">sample </a>

Now, i need to retrieve the value, sample and pass it to another page.

Kindly help me on this.

Thanks.

Arthi,

//raw javascript
var anchorText = document.getElementById('myAnchor').innerHTML;

//jQuery
var anchorText = jQuery('#myAnchor').html();

Both statements will only work once the HTML has been translated into DOM elements, typically in the handler for some event that occurs after the page has loaded, notably window.onload .

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.