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);
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);
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());
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>
simply it set the innerHTML of all div of class result to the value of html