I have
$(elements[current]).html();
that returns
<a href="#"><img style="width:991px;height:230px;" src="img/image.jpg" alt="img"></a>
and i need to get the element a href value only. how can i do this?
I have
$(elements[current]).html();
that returns
<a href="#"><img style="width:991px;height:230px;" src="img/image.jpg" alt="img"></a>
and i need to get the element a href value only. how can i do this?
$(elements[current]).find('a').attr('href')
html(), the a is a child node of elements[current]$("a", "elements[current]").attr('href'). It does the same thing, without the need to use .find :)elements[current] which will make it not work.There is .attr() method in jquery that allow you to get and set the attribute of the html element.
Example : $("img").attr("alt");