开发者

Other ways to use jQuery(html, [ownerdocument | props])?

With jquery, besides using the $(selector) syntax, there is also a syntax that is shown for usage as $("<p>someHTML</p>"). Now, the only samples of this usage I can find are with appendTo.

I'm sure there ar开发者_如何学JAVAe other great uses of this feature, but I can't seem to find any documentation on it, or examples of implementation.

It doesn't seem like I can run .find() over it however, but perhaps I set something up incorrectly in my trying it out.


This is a way to wrap html into a JQuery object for further usage. Very handy. And yes, you can run find over it.

$("<div><p>First</p><p>Second</p></div>").find("p").each(function(i) {
    alert((i + 1) + " - " + $(this).text());
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜