javascript : domElement .isVisible()

 

javascript : domElement .isVisible()


Target:

Applicable with any DOM element.

  • getElementById
  • getElementsByTagName
  • getElementsByClassName
  • getElementsByName
  • querySelector
  • querySelectorAll

Description :

return true if target element or first element of list is visible other wise false.


Syntax:

DOMElement.isVisible()

DOMNodeList.isVisible()

HTMLCollection.isVisible()


Usase:

  1. document.getElementById('firstDiv').isVisible()
    it return true if firstDiv element is visible other wise false
  2. document.getElementsByTagName('div').isVisible()
    the getElementsByTagName selects all div but isVisible() method check for only first div and if it is visible then return true else false.
  3. document.getElementsByClassName('FirstDiv').isVisible()
    the getElementsByClassName selects all div having class "FirstDiv" but isVisible() method consider only first element and return true if it is visible other wise false.
  4. document.getElementsByName('FirstDiv').isVisible()
    the getElementsByName selects all elements having name attribute "FirstDiv" but isVisible() method consider only first element and return true if it is visible other wise false.
  5. document.querySelector('.FirstDiv').isVisible()
    the querySelector selects first div having class "FirstDiv" and isVisible() method check whether it is visible or not
  6. document.querySelectorAll('.FirstDiv').isVisible()
    the querySelectorAll selects all div having class "FirstDiv" but isVisible() method consider only first element and return true if it is visible other wise false.


Download MYJS.js

MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type. 

Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.

Comments

Popular posts from this blog

javascript : String.right

javascript : String.left

javascript : .nextAll()