How to stop adding the same words, that <element> already has
Well, I start from gathering 7 values from 7 <tr>'s:
name 1
name 2
name 3
name 4
name 4
name 5
name 6
- var names = $("tbody tr").map(function(ind, obj){
- return $(this).children().eq(3).text();
- });
But I need to remove duplicates, such as
name 4
How can I do that?
This code doesn't work for preventing text duplicates:
- $("span#complex").text(
- $.map(names, function(obj, ind){
- if( $("span#complex").is(":contains(names[ind])") )
- return;
- else
- return names[ind];
- }).join(", ")
- );