JS HTML Dom

Finding HTML elements by Id <!DOCTYPE html> <html> <head> <style type="text/css">body { background-color: Green; }</style> </head> <body> <h1 id="myH1tag">This is the inner HTML if the H1 tag</h1> <p>This is a…

Continue Reading JS HTML Dom

Javascript HTML DOM Document

Finding HTML elements using javascript document.getElementByID : finds an element with an id attribute document.getElementsByClassName : finds an element by its class name (this is HTML5 specific) document.getElementsByTagName : finds…

Continue Reading Javascript HTML DOM Document

Simple javascript DOM event

<!DOCTYPE html> <html> <body> <h1 onclick="this.innerHTML = 'You clicked'">Click on this text</h1> </body> </html> In the following example, the onclick event calls a function 'changetheText'. <!DOCTYPE html> <html> <body> <h1…

Continue Reading Simple javascript DOM event