Search
 
SCRIPT & CODE EXAMPLE
 

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>`
Comment

PREVIOUS NEXT
Code Example
Javascript :: React Using Self Made Module 
Javascript :: jquery ajax success function not executing 
Javascript :: datatables data in one line 
Javascript :: ip scanner node 
Javascript :: SordMap elo 
Javascript :: js a || b 
Javascript :: Set Up Model In MongoDB 
Javascript :: communicate between content script and bg 
Javascript :: Get First Second Third Term In Array 
Javascript :: Declaring A Method Outside The Constructor 
Javascript :: Joi conditional validation refer parent object 
Javascript :: javascript call function change last default value 
Javascript :: nestjs prisma controller 
Javascript :: magnetic button vanilla js 
Javascript :: useState increase Likes 
Javascript :: var sumArray = function(arr) {}; 
Javascript :: Backbone Model Most Simple 
Javascript :: how to render react quill the way it is without the html tags 
Javascript :: how to check if a div tag contains child 
Javascript :: Solution-4-C--solution options for reverse bits algorithm js 
Javascript :: decode jwt token in angular 
Javascript :: convert milliseconds to dd/mm/yyyy javascript 
Javascript :: for loop javascript array of objects 
Javascript :: class in js 
Javascript :: dart to json 
Javascript :: animation js 
Javascript :: run function periodically with setInterval 
Javascript :: how dynamique pseudo element in react 
Javascript :: javascript Remove Element from Inner Array 
Javascript :: intervals 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =