Utilities/API/jQuery
jQuery.unique(array)
配列中から重複している値を除去し、ユニークになったものを返します。
サンプル
サンプル1
var divs = $("div").get();
// add 3 elements of class dup too (they are divs)
divs = divs.concat($(".dup").get());
$("div:eq(1)").text("Pre-unique there are " + divs.length + " elements.");
divs = jQuery.unique(divs);
$("div:eq(2)").text("Post-unique there are " + divs.length + " elements.")
.css("color", "red");
[全コードを表示]
[実行結果を単体で表示]