HTML and CSS Reference
What if you wanted to just add more text after what is already there? To do this, you could simply use the += operat-
or instead of = . Here's an example:
document.getElementById(“firstParagraph").innerHTML += “ This text
was added to the end of the current text.";
Manipulating Attributes and Properties
To inspect all the properties that an element has, you can use the dir() function in the developer tools console.
This will show you a list of all the element's properties as well as its child elements.
Take a look at the properties of the email input by selecting it using getElementById .
This should display a really long list of properties. You can ignore most of them at this stage, but the key properties
are those that link to the element attributes, such as id , class , placeholder , and value .
Let's update the value of this field. To do this, select the <input> element, specify the property you would like to
change, and then assign it a value. Oh, by the way: Did I mention that you can create variables in the console? Let's
also create a variable to store the email field so that you don't have to type the selection code every time.
var emailField = document.getElementById(“email");
emailField.value = “email@example.com";
You should now see that the value of the email field has been updated to the e-mail address you specified.
dating content and properties based on user input and events.
you to write less code. Some of these libraries address cross-browser compatibility issues, and some give you easy
ways to create interactive widgets for your pages. Some even do both.
the order in which it discovers them. You need the library to be seen first so that you can use the functions that it