3

I'm using Chosen jquery plugin. It shows "no results" if none found. Is thera a way to trigger a function if no results found using this plugin?

Mayank Awasthi
  • 337
  • 3
  • 14

2 Answers2

2

Now, There is event chosen:no_results that you bind function to like this:

     $('select.chosen-select').bind('chosen:no_results', chosenNoResults);

    function chosenNoResults(evt, params) {
             //Add new Option Logic
     }

enter image description here

Refer Github for Reference

pk_code
  • 2,608
  • 1
  • 29
  • 33
1

As a developer of Chosen I can safely tell you that there is currently no callback or event triggered when there are no results.

Although you could submit a feature request as an issue at the GitHub repository

The last few weeks there has been active development on Chosen, so changes of quick action upon your request are good.

Koen.
  • 25,449
  • 7
  • 83
  • 78
  • I have checked there. THere is an open request for this feature Link: https://github.com/harvesthq/chosen/pull/166 – Mayank Awasthi Aug 13 '13 at 12:51
  • That is my PR yes, but I thought that you were talking about just a simple event/callback, without the possibility of adding an option – Koen. Aug 13 '13 at 13:23
  • Ultimately I want to achieve that. If i can trigger a function I can do what i want. – Mayank Awasthi Aug 13 '13 at 13:53
  • I have already implemented this solution but anyway thank you for your valuable help and since this answer is useful in getting solution of the actual problem so I am accepting it as accepted answer. – Mayank Awasthi Aug 14 '13 at 12:22