html JS Flashcards
How is JavaScript embedded inside an HTML page?
We can create a
“”
in head or body. We can define functions here and these functions can be called by button onClick event.
How do u get developer tools in a browser?
Right click on the page, choose ‘inspect’.
or,
CTL Shift j
In developer tools, how can various web page elements be accessed?
By using “document” object, which represents current web page displayed in the browser.
We can print the value of “title” by typing,
document.title
in the console.
How do u access a web page’s elements in JavaScript?
By assigning elements an id, and accessing them in JS using getElementById(“id”);
<h1>Taaza Khhabar</h1>
document.getElementById(“headline”);
What is a quick way to get an output msg from a web page.
use alert("ABCD"); in a JavaScript.
u can also use console.log(“ABCD”);
This will appear in developer console.
How do u associate an event listener to a button.
By calling
buttonID.addEventListener(‘click’, function);
How to get chrome developer tools?
Right click on the page, and select “inspect”
or
press F12 key