JQuery Syntax Question?
What does the following JQuery code mean and how would the HTML code look like using the following J开发者_运维知识库Query code?
Here is the JQuery code.
$("div.result").html(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>
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());
simply it set the innerHTML of all div of class result to the value of html
加载中,请稍侯......
精彩评论