What are the repeated javascript-jquery-delegate () binding elements?

Source: Internet
Author: User
For example, if I use delegate () to bind an inputtext box (nameexp []) and multiple boxes appear, how can I remove duplicates? HTML {code...} js {code...} also has some inputtext boxes I dynamically add, which is why I use delegate () binding. The consequence of repetition is...

For example, I used delegate () to bind an input text box (name = exp []). How can I remove duplicates when multiple boxes appear?
HTML

'form-control','required'=>'required']) ?>

Js

$('p').delegate('input[name="ruleexp[]"]','blur',function(){    //code});

Some input text boxes are dynamically added, which is why I use delegate () binding.
The consequence of repetition is that I print out the input value and multiple results are displayed ..

Reply content:

For example, I used delegate () to bind an input text box (name = exp []). How can I remove duplicates when multiple boxes appear?
HTML

'form-control','required'=>'required']) ?>

Js

$('p').delegate('input[name="ruleexp[]"]','blur',function(){    //code});

Some input text boxes are dynamically added, which is why I use delegate () binding.
The consequence of repetition is that I print out the input value and multiple results are displayed ..

$ ('P '). undelegate (). delegate ('input [name = "ruleexp []"] ', 'blur', function () {// code.

Change delegate () to on (). In addition, you cannot clearly describe it because there is only one 'input [name = "ruleexp []"] ', you have multiple results, or because there are already multiple results, do you want to filter out one?

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.