Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9238615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:48:11+00:00 2026-06-18T07:48:11+00:00

I define a tag picker which will generate checkbox inputs based on group. If

  • 0

I define a tag picker which will generate checkbox inputs based on “group”. If I select the tags I want and press done button, it should return a string to set the value of a text input.

Here are the related codes. The problem is it only works well at the first time. For example, for the first time, if I checked ‘jquery’,’javascript’ in the tags,

console.log('output is:' + tags);

print out ‘output is: jquery,javascript’. Works!
Then I use it again and select ‘jquery’,’javascript’,’bootstrap’,
it will return

output is: jquery,javascript,bootstrap
output is: 

One more time for ‘jquery’,’javascript’,’bootstrap’, it returns

output is: jquery,javascript,bootstrap
output is:
output is:

Seems the done button pressed, the function is called repeatedly. Being stuck with it for several hours but can’t figure out. Really appreciate for your answer! Thanks

(function(){
  $.fn.tagPicker = function(source,options){
    var settings = $.extend({
      perRow : 3
    },options);

    $.fn.attachRow = function(row,col){
      //codes here
      ...
    }

    $.fn.attachPicker = function(){
      //codes here
      // generate html for checkbox inputs
      ...
    };

    var $input = this;

    if($('.tag-picker').length == 0){ 
      $input.attachPicker(); 

      $('body').on('click','.tag-picker .close-picker',function(){
        $('.tag-picker').remove();
      })

      $('.tag-picker .close-picker').off();

      $('body').on('click','.tag-picker #btn-done', function(){
        var tags = getTags();
        $('.tag-picker').remove();
        console.log('output is:' + tags);
        $input.val(tags);       
      });
    }

    function getTags(){
      var t = [];
      $('.tag-picker input').each(function(){
        if($(this).is(':checked')) t.push($(this).attr('id'));
      })
      return t.join(',');
    }
  }
})(jQuery);

$('body').on('click','input.participant',function(){
      $(this).val('');
      $(this).tagPicker(group);           
})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:48:12+00:00Added an answer on June 18, 2026 at 7:48 am

    You are initialising the plugin every time the elements are clicked. You should initialise it once, on DOM ready.

    OR if you want to do this anyway; you could use .one() for the event to run only once and remove itself. Use .off() to detach an event, attached with .on().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to define a tag separator tag, which inside a list tag, can
I just want to know how to define HTML Tag <br clear=all> after each
Im trying to define a select tag in my view. My view looks like
I just want to define id attribute of body tag in child template. First
I want to define a tag in my schema for anything. It should be
I need to define a jsp tag which named include. It should be used
I found these lines: #undef TAG #define kTAG @"TestRegistration///: " #define TAG kTAG If
I am trying to define a border around a div tag in HTML. In
I understand the usage of standard fmt:message Tag i.e we define something like this
For example when I define a style tag in XML, all views of all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.