javascript Translate html links into text and keep the url as text -


ok have been looking around not found want. javascript function ideally transalate tag this

<a href="https://www.outlook-apps.com/blog/"> tips &amp; tricks – outlook tools &amp; utilities</a>   tips &amp; tricks – outlook tools &amp; utilities     https://www.outlook-apps.com/blog/ 

is there library available out there?

here is:

const = document.queryselector('a');  const src = a.href;  const sentence = a.textcontent;  const parent = a.parentelement;    const text = document.createtextnode(`${sentence}   ${src}`);    window.settimeout(() => {      parent.insertbefore(text, a);    parent.removechild(a);  }, 2000);
<a href="https://www.outlook-apps.com/blog/">  tips &amp; tricks – outlook tools &amp; utilities</a>


legacy

function makeastext(selector) {    var = document.queryselector(selector);    var src = a.href;    var sentence = a.textcontent;    var parent = a.parentelement;      var text = document.createtextnode(      sentence + '\n' + src    );      parent.insertbefore(text, a);    parent.removechild(a);      }    makeastext('a');
    <a href="https://www.outlook-apps.com/blog/">      tips &amp; tricks – outlook tools &amp; utilities</a>


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -