Explain Javascript Properties Set Elements Innerhtml Outerhtml Class Style Q37040576

Explain these JavaScript properties that can be set forelements: innerHTML, outerHTML, class, style


Answer


`Hey,

Note: Brother in case of any queries, just comment inbox I would be very happy to assist all your queries

innerHTML = HTML inside the selected element.

outerHTML = HTML inside the selected Element + HTML of theselected element.

Example :

<div>

<span>Hello there!</span>

</div>

innerHTML : here if you do innerHTML on div, itwill return object containing <span> only.

outerHTML: if you do the outerHTML on div youwill get an object containing div and span inside that.

A JavaScript class is a type of function. Classes are declaredwith the class keyword. We will use

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.