Answers for "convert string element to html tag in javascript"

4

convert a string to html element in js

/**
 * Convert a template string into HTML DOM nodes
 * @param  {String} str The template string
 * @return {Node}       The template HTML
 */
var stringToHTML = function (str) {
	var parser = new DOMParser();
	var doc = parser.parseFromString(str, 'text/html');
	return doc.body;
};
Posted by: Guest on May-28-2020
1

convert element to html string

html_entity_decode

$temp = "<font class='red font-price'> 30 </font>";
echo html_entity_decode($temp);
Posted by: Guest on November-09-2020

Code answers related to "convert string element to html tag in javascript"

Browse Popular Code Answers by Language