Posts

Showing posts with the label text

javascript : DomElement .text()

  javascript : DomElement .text() Target: Applicable with any DOM element having attribute innerText. getElementById getElementsByTagName getElementsByClassName getElementsByName querySelector querySelectorAll In case of DOM NodeList first Node Element is processed for get innerText. Description : get innerText of DOM element. Syntax: DOMElement.text() DOMNodeList.text() HTMLCollection.text() Usase: document.getElementById('firstDiv').text() it returns the innerText of firstDiv, that is " welcome " document.querySelector('#firstDiv').text() it returns the innerText of firstDiv, that is " welcome " document.querySelectorAll('div').text() it returns the innerHTML of first div's, that is " welcome " document.getElementsByTagName('div').text() it returns the innerHTML of first div's, that is " welcome " Download MYJS.js MyJs is a collection of java script extension methods that enhances the JavaScript obj...