Select2 triggers the change event on the original element whenever its value is changed by the user:

eg Code:

  1. $(“#e11”).select2({
  2. placeholder: “Select report type”,
  3. allowClear: true,
  4. data: [{id: 0, text: ‘story’},{id: 1, text: ‘bug’},{id: 2, text: ‘task’}]
  5. });
  6. $(“#e11_2”).select2({
  7. createSearchChoice:function(term, data) { if ($(data).filter(function() { return this.text.localeCompare(term)===0; }).length===0) {return {id:term, text:term};} },
  8. multiple: true,
  9. data: [{id: 0, text: ‘story’},{id: 1, text: ‘bug’},{id: 2, text: ‘task’}]
  10. });
  11. function show(e) {
  12. details = {val:e.val, added:e.added, removed:e.removed};
  13. details=JSON.stringify(details);
  14. var e=$(“<li>change fired: “+details+”</li>”);
  15. $(“#events_11”).append(e);
  16. e.animate({opacity:1}, 10000, ‘linear’, function() { e.animate({opacity:0}, 2000, ‘linear’, function() {e.remove(); }); });
  17. };
  18. $(“#e11”).on(“change”, show);
  19. $(“#e11_2”).on(“change”, show);

45 responses »

  1. d3 items says:

    I regard something really interesting about your website so I saved to favorites .

  2. d3 items says:

    Hello, i feel that i saw you visited my website so i got here to “return the desire”.I’m attempting to find issues to enhance my website!I assume its good enough to make use of some of your ideas!!

  3. Hi, i believe that i noticed you visited my web site thus i got here to “return the prefer”.I am attempting to to find things to enhance my site!I assume its good enough to use a few of your ideas!!

  4. Hey, I just stopped by to visit your website and thought I’d say thanks for having me.

  5. I love your useful blog. excellent contribution. I hope you produce many. I will carry on reading

  6. nootropic says:

    Very interesting information!Perfect just what I was searching for!

  7. nootropic says:

    Hi, i think that i saw you visited my website thus i got here to “go back the desire”.I’m trying to find things to enhance my website!I suppose its good enough to use some of your ideas!!

  8. jailbreak says:

    You have remarked very interesting points! ps nice site.

  9. jailbreak says:

    I admired your insightful writing. brilliant contribution. I hope you write others. I will continue subscribing

  10. This article has inspired me to continue writing on my own blog

  11. This writing has inspired me to continue focusing on my own blog

  12. anxiety says:

    salutations from across the world. excellent article I must return for more.

  13. This blog has inspired me to start writing on my own blog

  14. This writing has inspired me to carry on focusing on my own blog

  15. Aion Kinah says:

    This article has inspired me to continue working on my own blog

  16. d3 items says:

    salutations from across the world. Great post I shall return for more.

  17. d3 gold says:

    You have noted very interesting details! ps decent site.

  18. d3 gold says:

    Greeting from over the ocean. precise post I must return for more.

  19. jailbreak says:

    I love your useful post. great contribution. I hope you release others. I will continue reading

  20. Very interesting info!Perfect just what I was looking for!

  21. vitamins says:

    salutations from over the ocean. detailed article I must return for more.

  22. vitamins says:

    Hello, i feel that i noticed you visited my weblog thus i got here to “return the desire”.I am attempting to in finding issues to improve my website!I assume its good enough to use a few of your concepts!!

  23. l-tyrosine says:

    Very interesting information!Perfect just what I was searching for!

  24. l-tyrosine says:

    salutations from over the world. precise blog I shall return for more.

  25. incontinence says:

    This writing has inspired me to continue working on my own blog

  26. picamilon says:

    Very interesting information!Perfect just what I was looking for!

  27. notropics says:

    Hello, i believe that i saw you visited my weblog so i came to “return the desire”.I am trying to in finding issues to improve my web site!I guess its adequate to use a few of your concepts!!

  28. This article has inspired me to carry on writing on my own blog

  29. nootropics says:

    Hello, i believe that i noticed you visited my website so i got here to “return the want”.I am attempting to find things to improve my web site!I guess its adequate to make use of some of your concepts!!

  30. I’m not sure why but this weblog is loading incredibly slow for me. Is anyone else having this issue or is it a problem on my end? I’ll check back later and see if the problem still exists.

  31. Hello, i think that i noticed you visited my web site so i got here to “return the desire”.I am trying to find things to enhance my site!I guess its ok to use a few of your ideas!!

  32. aion kinah says:

    Greeting love your time take a look of mine

  33. fitness says:

    I am typically to running a blog and i really respect your content. The article has really peaks my interest. I am going to bookmark your website and preserve checking for brand spanking new information.

  34. fitness says:

    I am impressed with this site, rattling I am a big fan .

  35. I cannot thank you enough for the blog.Much thanks again. Want more.

  36. very nice post, i certainly love this website, keep on it

  37. MMO says:

    Keep up the wonderful piece of work, I read few blog posts on this web site and I conceive that your site is really interesting and has got sets of good information.

  38. That is a great tip especially to those fresh to the blogosphere. Brief but very accurate info… Thanks for sharing this one. A must read post!

  39. lubartów says:

    very good post, i certainly love this web site, carry on it

  40. Hello! I could have sworn I’ve been to this blog before but after looking at many of the posts I realized it’s new to me. Anyhow, I’m definitely pleased I came across it and I’ll be bookmarking it and checking back frequently!

  41. “In the nation-wide study, which included over 53,000 participants, researchers found 20% fewer lung cancer deaths among those who were screened with low-dose helical CT (also known as spiral CT) compared with those who were screened with chest X-rays.”Great news!

  42. I arrived predicting something else entirely, but this enlightened me to something I wasn’t aware of. Well put together stuff.

As salam. Hi. Leave a Comment?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s