Javascript inneHTML method - Web Development
9 Views

Javascript inneHTML method

Javascript can display output in four different ways

Using innerHTML()
Using consol.log()
Using document.write()
Using window.alert()

To access users element we use innerHTML() .The id and class attributes define the HTML elements.

document.getElementById(“numberMult”).innerHTML this line will do multiplication & send output <p id=”numberMult”></p>

So output will be 129

Now lets see another example of innerHTML

You can concatenate javascript and html tags using + sign. Here i have concatenated html font tag with javascript variable with help of + sign .

Output of code

Javascript innerHTML Example

Lets see form example using innerHTML

Output of Code



We have called innerHTML inside a function and function called in onclick event of button.

See more tutorials web development

Leave a Reply

Your email address will not be published. Required fields are marked *