Created
July 5, 2014 10:33
-
-
Save stephenscaff/40b32bb6b5afeb91133b to your computer and use it in GitHub Desktop.
Remove placeholder/ first option from a DropKick.js select and corresponding unordered list output. Using DropKick in a rails app featuring a filter bar, needed to ensure select placeholders via 'prompt" would not be selectable. Since Dropkick.js makes an unordered list from selects, have to ensure that both the first select option and ul list i…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*---------------------------------------------- | |
| --Remove Prompt after change | |
| ----------------------------------------------- */ | |
| //target all styled selects and their generated unordered list | |
| $('.dk-drops').change(function(){ | |
| //Remove the first select option & it's corresponding generated list item | |
| $(".dk_options_inner li:first-child").remove(); | |
| $(this).find('option:first').remove(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment