JSFiddle - React, Tailwind, and code Playground
HTML
<div>one.1</div>
<div>one.2</div>
<div id="Quote_app">
<div>two</div>
<div>three</div>
</div>
JavaScript
NodeList.prototype.forEach = function(f) {
for(var i = 0; i < this.length; i++) {
f.apply(null, [this[i]]);
}
};
Array.prototype.forEach = HTMLCollection.prototype.forEach = NodeList.prototype.forEach;
NodeList.prototype.filter = function(f) {
var results = [];
for(var i = 0; i < this.length; i++) {
if(f.apply(null, [this[i]])) {
results.push(this[i]);
}
}
return results;
};
Array.prototype.filter = HTMLCollection.prototype.filter = NodeList.prototype.filter;
NodeList.prototype.hide = function() {
this.forEach(function(e) {
e.hide();
});
};
Array.prototype.hide = HTMLCollection.prototype.hide = NodeList.prototype.hide;
NodeList.prototype.show = function() {
this.forEach(function(e) {
e.show();
});
};
Array.prototype.show = HTMLCollection.prototype.show = NodeList.prototype.show;
Element.prototype.isVisible = function() {
return this.style.visibility == 'visible' || this.style.visibility == '';
};
Element.prototype.show = function() {
this.style.visibility = 'visible';
};
Element.prototype.hide = function() {
this.style.visibility = 'hidden';
};
Element.prototype.toggle = function() {
this.isVisible() ? this.hide() : this.show();
};
var Controls = document.getElementById("Quote_app").getElementsByTagName("div");
var Control = document.getElementsByTagName("div")[0];
Control.toggle();
Controls.filter(function(c) {
return c != Control && c.isVisible();
}).hide();