“JS -Text an HTML” Code-Antworten

Js konvertieren HTML in Text

// To remove all HTML tags use the ".replace(/<[^>]+>/g, '')" method.
let myHTML= "<div><h1>Jimbo.</h1>\n<p>That's what she said</p></div>";
let strippedHtml = myHTML.replace(/<[^>]+>/g, '');
console.log(stripedHtml); // Jimbo. That's what she said
Undefined

JS -Text an HTML

var textToHTML= function (str) {

	var dom = document.createElement('div');
	dom.innerHTML = str;
	return dom;

};
Fine Fish

Ähnliche Antworten wie “JS -Text an HTML”

Fragen ähnlich wie “JS -Text an HTML”

Weitere verwandte Antworten zu “JS -Text an HTML” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen