javascript - Regex string that copy from one link to another -
There are two links on my page, I need jquery or a pure js script to do this on page load:
Find this link with the link before any link
and copy any link from any VALUE to another link
& lt ; A href = "http://domain.com/docs/ANY VALUE /" & gt; Link 1 & lt; / A & gt; & Lt; A href = "http://domain.com/images/ANY VALUE goes here" /> & gt; Link 2 & lt; / A & gt;
& lt; A href = "http://domain.com/docs/author=1" id = 'link1' & gt; Link 1 & lt; / A & gt; & Lt; A href = "http://domain.com/images/ANY VALUE goes here /" id = 'link2' & gt; Link 2 & lt; / A & gt; Add id for both links, as above. And use this JQuery snippet
ANY_VALUE = $ ('# link1'). Attr ('href'). Division ('Docs /') [1] $ ('# link2'). Attr ('href', 'http: //domain.com/images/'+ANY_VALUE)
Comments
Post a Comment