Posts

Showing posts from October, 2023

Level no.25

 Java-Script Lecture #3 Q. What is the purpose of .innerHTML, .value and .textContent in java-script? .innerHTML, .value and .textContent are not used for same purpose in java-script, they serve different roles when working with HTML elements. They might have similar syntax because they are properties of   DOM elements in HTML, DOM stand for Document Object Model.  1. .innerHTML: This property is used to get or set the HTML content within an element. You can use this to retrieve  the HTML content inside an element or to change it by assigning new HTML content to it. 2. .value: This property is used with for elements like input fields, checkbox and radio buttons  to get or set their current values. You can use this to retrieve the current value of the input fields or to  set a new values, you can get or set the input fields values through java-script. 3. .textContent: This property is used to get or set the text content of the element. You can use this property to retrieve the plain tex