New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to assign a placeholder for the search field #3362
Comments
+1. Btw. While it's not implemented I'm using following workaround: selectElement.on('select2-open', function() {
$('.select2-input').attr('placeholder', 'Start typing to find');
});
selectElement.on("select2-close", function() {
$('.select2-input').attr('placeholder', null);
}); |
+1 In v4.0 I had to use:
|
The reason this would be quite useful is that if I am filtering the list on multiple properties (e.g., name OR phone number OR email) I could add a placeholder to help the user -- "Search by customer name, phone number, or email" |
@KevP I used your solution but if I had a multiple select too the text "S" of "Search..." appears on it I solved it with (your solution fixed): $("#my_dropdown").on("select2:open", function() {
$(".select2-search--dropdown .select2-search__field").attr("placeholder", "Search...");
});
$("#my_dropdown").on("select2:close", function() {
$(".select2-search--dropdown .select2-search__field").attr("placeholder", null);
}); |
There seems to be an un-documented option (at least in version 3.5.4) called searchInputPlaceholder that provides this functionality. |
The option searchInputPlaceholder no longer work on the current version :( |
Is there a plan to put this option back in? It would be handy. |
I've created a small extension in order to implement 'searchInputPlaceholder' option. |
This is great! Would you be willing to set this up in a dedicated repo? |
@alexweissman, I've created a small repository for this extension: |
Nice! Looks good. You should also be able to use the new "topics" feature to label your repo with "select2" as well. |
|
We don't have immediate plans to provide this. We are focused to fix some major UI bugs (that are majority of issues and PR's). But if you open a PR with unit tests, I will be glad to review and approve if everything is ok 👍 |
There is a option to add a placeholder for the select field but not for the search field.
It would be nice to be able to have a option to add a placeholder for the 'search' input field.
The text was updated successfully, but these errors were encountered: