Extract URL From HTML Using Javascript And Use It In A Function
I need to extract URL link from html. There is only one such link on the whole page. Then I need to add use it as a.href in this fun
Solution 1:
Solution 2:
document.getElementsByTagName("a")[0].getAttribute("href");
Solution 3:
function changespan() {
var spans = document.querySelectorAll('span.image');
for (var i = spans.length; i--; ) {
var a = document.createElement('a');
a.href = $(".1").attr('href');
spans[i].appendChild(a).appendChild(a.previousSibling);
}
}
Post a Comment for "Extract URL From HTML Using Javascript And Use It In A Function"