How to get in JS the value of a 'link' element

ydl

New Member
I want to get the value of the "url" from a 'link' element.

I wrote the following:

var $linkVal = $('table_name___element_name_ro');
alert ('address = ' + $linkVal.textContent);

I am getting the title of the link BUT not the url value.
What is the correct way to retrieve the value of the link?
 
I find a solution.

First the code:
var $linkVal = $('table_name___element_name_ro');
var addrVal = $linkVal.getElementsByTagName('a')[0].attributes['href'].value;
alert ('address = ' + addrVal);

Explanation:
line 1: retrieve the fabrik element which is the 'a' tag encapsulation
line 2: retrieve the 'a' tag and its attribute 'href'
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top