Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

replace text content with element node

/*
<span>
  https://example.com
</span>
*/

const span = document.querySelector('span')
span.innerHTML = `<a href='${span.textContent}'>${span.textContent}</a>`
Source by thewebdev.info #
 
PREVIOUS NEXT
Tagged: #replace #text #content #element #node
ADD COMMENT
Topic
Name
1+3 =