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…
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…
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…
General terminology is: Objects - HTML elements themselves are referred to as objects. Property - is a value than can be 'set', or 'get' a value of that property. Like…
<!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…