Toggles the element's opacity and visibility style - Node.js DOM

Node.js examples for DOM:Element

Description

Toggles the element's opacity and visibility style

Demo Code

/**//ww w. java  2  s . c  om
 * Toggles the ele element's opacity and visibility style
 * @param ele
 */
function toggleOpacity(ele) {
  if (ele.style.opacity=='0') {
    ele.style.opacity='1';
    ele.style.visibility='visible'
  } else {
    ele.style.opacity='0'
    ele.style.visibility='hidden';
  }
}

Related Tutorials