1

What does the following JQuery code mean and how would the HTML code look like using the following JQuery code?

Here is the JQuery code.

$("div.result").html(html);

3 Answers 3

1

Your snippet searches the HTML document for a <div> with the class name result. If the element is found then the contents of html will replace the contents of the found element.

Thus, if html is Hello <strong>World</strong>! This:

<div class="result">Well, <em>hi</em> there.</div>

Will be:

<div class="result">Hello <strong>World</strong>!</div>
Sign up to request clarification or add additional context in comments.

Comments

0

That will throw a error, unless the html variable is set elsewhere.

If you are trying to set the HTMLto itself, why? But it would be:

$("div.result").html($(this).html());

Comments

0

simply it set the innerHTML of all div of class result to the value of html

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.