Question

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

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

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

innerHTML = HTML inside the selected element.

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

Example :

<div>

<span>Hello there!</span>

</div>

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

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

A JavaScript class is a type of function. Classes are declared with the class keyword. We will use function expression syntax to initialize a function and class expression syntax toinitialize a class. We can access the [[Prototype]] of an object using the Object.getPrototypeOf() method.

A JavaScript class is a type of function. Classes are declared with the class keyword. We will use function expression syntax to initialize a function and class expression syntax to initialize a class.

// Initializing a function with a function expression
const x = function() {}
// Initializing a class with a class expression
const y = class {}

We can access the [[Prototype]] of an object using the Object.getPrototypeOf() method. Let's use that to test the empty function we created.

Object.getPrototypeOf(x);
 

Output

ƒ () { [native code] }

The Style object represents an individual style statement. It helps us to change the css of any block the object referring to.

document.getElementById("myH1").style.color = "red";

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Explain these JavaScript properties that can be set for elements: innerHTML, outerHTML, class, style
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT