Js scripts implement data de-duplication and js scripts implement data
Project requirements:
Code:
Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Script src = "jquery. js"> </script>
<Script type = "text/javascript">
$ (Function (){
Var divArea = $ (". drop ");
$. Each (divArea, function (){
Var Dtxid = $ (this). text ();
Var count = 0;
$. Each (divArea, function (){
Var Xtxid = $ (this). text ();
If (Dtxid = Xtxid ){
Count = count + 1;
If (count> = 2 ){
$ (This). remove ();
}
}
})
})
});
</Script>
</Head>
<Body>
<Div> original data </div>
<Div>
<Span> zhangsan </span>
<Span> Li Si </span>
<Span> Wang Wu </span>
<Span> zhangsan </span>
<Span> Wang Wu </span>
</Div>
<Br/>
<Div> data deduplication </div>
<Div>
<Span class = "drop"> Michael </span>
<Span class = "drop"> Li Si </span>
<Span class = "drop"> Wang Wu </span>
<Span class = "drop"> Michael </span>
<Span class = "drop"> Wang Wu </span>
</Div>
</Body>
</Html>
Isn't it easy? If you have the same requirements, let's take a look at it for your own reference. Here is just a simple example. To use the project, you also need to add some materials for your friends.