结合两个HTML选择与jQuery [英] Combine two html selections with jquery
本文介绍了结合两个HTML选择与jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能在jquery中将两个html选择结合起来?
Is it possible two combine two html selections in jquery?
var derp1 = $('#derp1').html();
var derp2 = $('#derp2').html();
var combDerp = derp1.add(derp2);
$('#derpina').html(combDerp);
我想将html的两个特定部分显示为一个,并在页面的另一部分中显示它们.任何帮助都非常感激:)
I want to show two certain parts of html into one and display them in another section of the page. Any help is well appreciated :)
推荐答案
由于您获取了每个HTML文件的HTML,因此可以将两者连接在一起.
Since you are getting the html of each, you can just concatenate the two.
$('#derpina').html(derp1 + derp2);
或者,您可以获取实际的节点并将其移动.
Or, you can take the actual nodes and move them.
var derp1 = $("#derp1");
var derp2 = $("#derp2");
$("#derpina").html(derp1.add(derp2));
这篇关于结合两个HTML选择与jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文