Saturday, September 3, 2022

JavaScript DOM manipulation

https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction

WEB APIs unclude DOM methods and properties.


let let1, let2, let3, let4; // global variables without values

const func1 = function () { let1 = 0; let2 = 2; let3= [3, 3, 3], let4= true } // reassign values in =>


const displayMessage = function (message) { // assign parameter to code to be executed

  document.querySelector('.message').textContent = message; // use parameter

};

displayMessage('My message'); // call function and pass arguments === parameter values


console.log(document.querySelector('.message').textContent);

console.log(document.querySelector('.message').textContent = 'Correct Number!');


document.querySelector('.guess').value = 23;

console.log(document.querySelector('.guess').value);

document.querySelector(selector) // don't forget about . (class) and # (id)

document.querySelectorAll(name)


getElementById()

getElementsByClassName()

getElementsByName()

getElementsByTagName()

getElementsByTagNameNS()

No comments:

Post a Comment