Semantic-ui: [Dropdown] Search prevents dropdown from showing on click

Created on 13 Jan 2017  路  5Comments  路  Source: Semantic-Org/Semantic-UI

If you have a dropdown with setting on: "click", adding class search to it prevents the dropdown from opening on click.

https://jsfiddle.net/dbr26njq/47/

Usage Question

All 5 comments

@jukestar it is suppose to work like that. Adding the search class to the drop down, turns the drop down to a search box, but values of drop down can still be accessed by clicking on the drop down icon.

https://jsfiddle.net/2ujuymmo/

@pranav-kural ok. Is there any way to make clicking on the search, to open the dropdown?

Try this
$('.ui.dropdown').on("click", function(){ $this = $(this).dropdown("show") })

@jukestar @dhvsandeep that code should be able to open the dropdown on click. But however, if you want it work like a normal dropdown, and close on the second (or alternative) click, you would do something like this:

$('.ui.dropdown').on('click', function() {
           var clicked = $(this).data('clicked');
           $(this).dropdown((clicked === undefined || !clicked) ? "show" : "hide");
       $(this).data("clicked", !clicked);
 });

That will also help in not affecting the normal working of any other drop down you might be using. (like the second one in the jsfiddle)

jsfiddle: https://jsfiddle.net/2ujuymmo/4/

@jukestar

Please use the Gitter chatroom, the official forums or StackOverflow to ask usage questions; see the contributing guidelines for more information on what kind of posts should find themselves into the GitHub Issues board.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Morrolan picture Morrolan  路  3Comments

batata004 picture batata004  路  3Comments

deneuxa picture deneuxa  路  3Comments

sarbona picture sarbona  路  3Comments

vinhtq picture vinhtq  路  3Comments