javascript - How to disable "no-results-text"? -


i want disable no-results-text in jquerys chosen 1.1.0.

i have tried codechanges, not expected results. reached disabled whole search-function or no-results-text "undefined".

where key disable no-results-text "no results match" , nothing else?

thanks lot!

according release 1.1.0 documentation, option can set when first call chosen function example:

$(".my_select_box").chosen(     disable_search_threshold: 10,     no_results_text: "oops, nothing found!",     width: "95%"   ); 

or

 $(".chosen-select").chosen({no_results_text: "oops, nothing found!"});  

sample using &nbsp entity disable text more 1 typed

<!doctype html>    <html class="no-js" lang="en">  <!--<![endif]-->    <head>  <link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.css" rel="stylesheet"/>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.jquery.min.js"></script>  <link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.min.css" rel="stylesheet"/>  </head>  <html>    <body>            <select data-placeholder="choose country..." class="chosen-select" style="width:350px;" tabindex="2">              <option value=""></option>              <option value="united states">united states</option>              <option value="united kingdom">united kingdom</option>              <option value="afghanistan">afghanistan</option>              <option value="aland islands">aland islands</option>              <option value="albania">albania</option>              <option value="algeria">algeria</option>      </select>        </body>      <script>       $(".chosen-select").chosen({no_results_text: "&nbsp"});    </script>  </html>

you add css within head tag after load jquery chosen plugin , its' css:

<style>       li.no-results {        visibility:hidden;       } </style> 

or modify source of chosen.css , add visibility:hidden no-results class remove message/text if there'are no results in search

sample adding visibility:hidden no-results class hide text

<!doctype html>    <html class="no-js" lang="en">  <!--<![endif]-->    <head>  <link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.css" rel="stylesheet"/>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.jquery.min.js"></script>  <link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.min.css" rel="stylesheet"/>            <style>          li.no-results{visibility:hidden;}      </style>  </head>  <html>    <body>            <select data-placeholder="choose country..." class="chosen-select" style="width:350px;" tabindex="2">              <option value=""></option>              <option value="united states">united states</option>              <option value="united kingdom">united kingdom</option>              <option value="afghanistan">afghanistan</option>              <option value="aland islands">aland islands</option>               </select>        </body>      <script>       $(".chosen-select").chosen({no_results_text: "this message hidden"});    </script>  </html>


Comments