tags:

views:

58

answers:

3

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);
A: 

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());
Dustin Laine
+1  A: 

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>
Jeremy
A: 

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

luca