JSFiddle - React, Tailwind, and code Playground

HTML

<div id="container">
    A text outside any tag<br/>
    <input type="button" id="iii" value="xxx"/>
    Another text<br/>
    <a href="#">A link</a>
</div>

CSS

#container {
    border: 1px solid red;
}

JavaScript

// thats ok
$("#container").contents().hide();

// seems to not work
$("#container").contents().filter(":text").hide();
// not working too
$("#container").contents().filter(function() {
	return this.nodeType === 3;
}).hide();

// thats ok
$("#container #iii").show();