Js scripts implement data de-duplication and js scripts implement data

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.