Nodejs Utililty Methods HTML Element Toggle

List of utility methods to do HTML Element Toggle

Description

The list of methods to do HTML Element Toggle are organized into topic(s).

Method

toggleAttribute(name, value = "")
Element.prototype.toggleAttribute = function(name, value = "") {
  if ( this.hasAttribute(name) ) {
    this.removeAttribute(name);
  else {
    this.setAttribute(name, value);
String.prototype.ucFirst = function() {
...
toggleDisplay()
Element.prototype.toggleDisplay = function() {
  if (this.style.display != "")
    this.style.display = "";
  else
    this.style.display = "none";
toggle()
HTMLElement.prototype.toggle = function toggle() {
    this.style.visibility = (this.style.visibility === "hidden") ? "visible" : "hidden";
};