在这里,我已经为上述问题完成了完整的垃圾箱。你可以通过演示链接。
演示 http://codebins.com/bin/4ldqp7n
HTML
<input type="button" id="btn1" value="Get Object Array Text" />
<input type="button" id="btn2" value="Reset" />
<div id="result">
</div>
jQuery
$(function() {
var items = ["<article>Article-1:Text</article>", "<article>Article-2:Text</article>", "<article>Article-3:Text</article>", "<article>Article-4:Text</article>", "<article>Article-5:Text</article>"];
$("#btn1").click(function() {
var result = "";
$.each(items, function(key, item) {
if ($(item).text().trim() != "") {
if (key > 0) result += " ";
result += $(item).text().trim();
}
});
if (result != "") {
$("#result").html(result);
$("#result").show('slow');
}
});
//Reset Result
$("#btn2").click(function() {
$("#result").html('').css('display', 'none');
});
});
演示 http://codebins.com/bin/4ldqp7n