JSFiddle - React, Tailwind, and code Playground

by thom801

HTML

<input id="my-input" type="text" value="<div><p>Hello World</p></div>">
<p id="result"></p>

CSS

#my-input {
    padding: 10px;
    margin: 0 0 20px 0;  
    width: 300px;    
}

JavaScript

// Get the value of the input
var inputText = $('#my-input').val();
// Store only the text and no HTML elements.
inputText = $(inputText)[0].textContent;
// Show the result
$('#result').html(inputText);