jquery-select2

Select2 - filtering special characters

橙三吉。 提交于 2019-12-24 04:23:22
问题 I have a problem with select2 plugin. When I use filter and type "mąka", it finds all the options with "mąka" and "maka" word. Is it possible to customize this script to find just the "mąka" word? Preview here Sorry for my english ;p Thanks! 回答1: From select2 site https://select2.github.io/examples.html#matcher fiddle : https://jsfiddle.net/alaniex/c3Ls1uf3/1/ function matchStart (term, text) { if (text.toUpperCase().indexOf(term.toUpperCase()) == 0) { return true; } return false; } $.fn

select2 not working when in google maps fullscreen

江枫思渺然 提交于 2019-12-24 02:03:08
问题 I have a google map that a user can go into fullscreen mode. I add a div with a dropdown as controls to the map and I apply the select2 plugin to the dropdown. The problem is the select2 dropdown doesn't show the list when the map is in fullscreen mode, when the map is not in fullscreen mode the dropdown works correctly. There are no errors in the console. I tried changing the z-index but had no luck. Any ideas? JSFiddle Example HTML <div id="wrapper"> <div id="testMap"> </div> <div id=

select2 not working when in google maps fullscreen

笑着哭i 提交于 2019-12-24 02:01:15
问题 I have a google map that a user can go into fullscreen mode. I add a div with a dropdown as controls to the map and I apply the select2 plugin to the dropdown. The problem is the select2 dropdown doesn't show the list when the map is in fullscreen mode, when the map is not in fullscreen mode the dropdown works correctly. There are no errors in the console. I tried changing the z-index but had no luck. Any ideas? JSFiddle Example HTML <div id="wrapper"> <div id="testMap"> </div> <div id=

$ is not defined, Uncaught ReferenceError while using Select2 plugin with Rails

不打扰是莪最后的温柔 提交于 2019-12-24 00:27:58
问题 I'm trying to use the Select2 plugin to add a search bar to my select box. I get the following error when looking at the page console : Uncaught ReferenceError: $ is not defined Searching different questions here led me to believe this error happens because the jQuery javascript is not included or put before the script is called. But I still could not find a way to make it work. How can I fix this error and make the select2 plugin work? Here is the application.js file : //= require jquery //=

Limit select2 selections by group?

江枫思渺然 提交于 2019-12-23 20:50:38
问题 Has anyone come up with a way to limit select2's selection by group? I'm hoping to auto-remove any selection from the same group once something from that group is selected (effectively limiting to one selection per group) I'll be working on something and will post it here if nobody posts a good solution before I'm finished. 回答1: It is possible to prevent selections from being made in Select2, so this can be done depending on how "group" is defined. If a "group" is an <optgroup> in a standard

Can't programmatically select option using Select2

霸气de小男生 提交于 2019-12-23 13:39:10
问题 I have a Select2 working fine attached to a select list but when someone enters a new item and I rebind the select list and try to programmatically select the new item, it refuses to display. There are a number of other posts re this but their solutions don't work for me. Use .select2("val", value) . Does nothing. Use .select2("data", value) . Does nothing. Not sure how this is supposed to be different. Use the InitSelection option to set a value. This leads to the following error message:

“Keypress” event is not working correctly, using jQuery & Select2

眉间皱痕 提交于 2019-12-23 10:26:56
问题 I have a forum in which I change the functionality of tab to enter. When the user presses enter the next input field get focus and somehow iImanage to open the select2 select box on focusin event so the select 2 box opens up. But, when I select the value and press enter in selec2 select box it does not close and remain open on enter key press event but it closes. When I change the enter key event to any keypress event than select2 get close and works fine but I have to do that by enter. What

:contains selector with Selenium and Select2

随声附和 提交于 2019-12-23 05:39:31
问题 I know that Selenium only supports the CSS selectors that the browser supports. In my HTML app I'm using jQuery but :contains(str) is still throwing me an invalid or illegal string was specified error. I'm typing text into a Select2 component, waiting 10 seconds, then trying to select the result. wd.findElement(By.id("s2id_autogen1")).sendKeys(p.getDisplayName()); // Wait 10 seconds wd.findElement(By.cssSelector(".select2-result-label:contains('"+p.getDisplayName()+"')")).click(); Why am I

Selenium Select2 command for drop-down box

空扰寡人 提交于 2019-12-23 05:06:05
问题 am new to selenium and in my previous question Selenium IDE command for input type hidden it is using select2 please help me with the command to selection option for drop-down list. i tried looking in here https://gist.github.com/3683275 but it doesn't seem to work for me mouseDown('//a[@class="select2-choice select2-default"][1]') mouseUp('//li[contains(@class,"select2-result")][1]') 回答1: These commands open the options list, wait for it to appear, and finally choose the option labelled

jQuery form repeater and select2 dont work together

£可爱£侵袭症+ 提交于 2019-12-23 04:09:36
问题 I am using Select2 and jQuery form repeater (https://github.com/DubFriend/jquery.repeater) I have searched on google/so for 2 days, but cant seem to get it to work. include jquery/select2.js/jquery.repeater.js var form = $('#form'); form.find('select').select2(); form.repeater({ show: function () { $(this).show(function(){ form.find('select').select2('destroy').select2(); }); }, hide: function (remove) { $(this).hide(remove); } }); The problem is the jQuery.repeater clones the div tag in