selectize.js

how to trigger selectize input to make options shown initially

坚强是说给别人听的谎言 提交于 2021-02-10 09:28:29
问题 I'm using selectize, and I want to show a few options without clicking selectize input. So I use $('.selectize-input').click() but it doesn't work. How to show a few options without clicking input? 回答1: Assuming that you bind selectize plugin something like $('.selectize-input').selectize(options) , you should be able to use API's open method like this: $('.selectize-input')[0].open(); 来源: https://stackoverflow.com/questions/31687392/how-to-trigger-selectize-input-to-make-options-shown

revise deeply nested JSON array in DOM

爱⌒轻易说出口 提交于 2021-01-29 12:21:51
问题 I have an HTML page that contains a stringified JSON object. The object has this structure: { "x":{ "key1":[], "key2":{}, "keyN":{}, "myKey":{ "randomID238492":{ "items":[ { "value":"zzzz" }, { "value":"aaaa" }, { ...} ] } } } } I want to replace this object with one in which the "items" array has been sorted. Here is what I will and won't know about the object: "myKey" and "items" will always be the relevant object keys "myKey" will contain only one random ID, and the "items" key will always

How to change the caret icon in selectize.js?

对着背影说爱祢 提交于 2021-01-27 06:14:28
问题 I want to change the caret icon in selectize.js to be like bootstrap's (glyphicon-menu) as shown in the image below: I am using (selectize.bootstrap3.css) and tried to play with this css file but no luck. 回答1: I have figured it out. I changed the following css classes inside (selectize.bootstrap3.css) file that render the icon: .selectize-control.single .selectize-input:after { content: '\e259'; /*This will draw the icon*/ font-family: "Glyphicons Halflings"; line-height: 2; display: block;

Get Today date & next 2 days - display in select option

和自甴很熟 提交于 2020-12-13 04:09:10
问题 I want to display date in below options. Have to get today date and display next 2 days date in select component. Plugin used - Selectize HTML: <select> <option value="31 Jul 2017">31 Jul 2017</option> <option value="1 Aug 2017">1 Aug 2017</option> <option value="2 Aug 2017">2 Aug 2017</option> </select> Sorry.. is there any possible solution available? Otherwise have to go with other approaches. Thanks 回答1: var dateRange = document.getElementById('date-range'), monthNames = ["Jan", "Feb",

Get Today date & next 2 days - display in select option

拈花ヽ惹草 提交于 2020-12-13 04:05:55
问题 I want to display date in below options. Have to get today date and display next 2 days date in select component. Plugin used - Selectize HTML: <select> <option value="31 Jul 2017">31 Jul 2017</option> <option value="1 Aug 2017">1 Aug 2017</option> <option value="2 Aug 2017">2 Aug 2017</option> </select> Sorry.. is there any possible solution available? Otherwise have to go with other approaches. Thanks 回答1: var dateRange = document.getElementById('date-range'), monthNames = ["Jan", "Feb",

How to change placeholder of selectize.js dropdown?

穿精又带淫゛_ 提交于 2020-06-24 22:57:10
问题 I want to change placeholder of a dropdown created by selectize.js when the parent dropdown changes its selection to load the options of the dropdown whose placeholder to be changed. There is no method to do this in documentation. 回答1: Not sure if selectize keeps changing their code or if everyone else on this thread just whiffed but all of these answers seem to be wrong individually, but if you kind of combine the correct parts from each answer you wind up with this which works for me. var

How can I set the Selectize.js multiple select input field to always be a single line?

陌路散爱 提交于 2020-01-24 13:22:06
问题 I have an Selectize.js multi input field, that has a fixes height and width. When I select several values, the field places the selected values into multiple lines, making the previous values hidden to the user. Is there any way I can force selectize to always place the values in a single line without going into a new line? 回答1: I too had this problem, ended up being a simple CSS fix: <style> .selectize-input { white-space: nowrap !important; } </style> This will turn off the wordwrap and

Get Text From Selected using selectize

假装没事ソ 提交于 2020-01-22 18:42:08
问题 I've tried this: var eventHandler = function() { return function() { console.log($select.val()); }; }; var $select = $('.selectize').selectize({ create : true, onChange : eventHandler() }); Which get me the value of the selected option but I need the text. When I do this: console.log($select.val().text()); I get an error. I've tried other things to no avail. How do I get the selected text? 回答1: select_option.getItem(select_option.getValue())[0].innerHTML; select_option = $select_option[0]

Selectizejs isn't loading the options correctly

China☆狼群 提交于 2020-01-16 18:50:14
问题 I'm using ajax, creating a dependent category and subcategory, everything works, my html is valid, I'm using selectizejs on both category and sub category. the category is working fine, the subcategory isn't. If I don't use selectize, everything works perfectly $(".category").change(function () { var id = $(this).val(); var dataString = 'id=' + id; $.ajax ({ type: "POST", url: "subcat.php", data: dataString, cache: false, success: function (html) { $(".subcat").html(html); } }); }); $('

Selectize.js pre populate

流过昼夜 提交于 2020-01-06 02:29:29
问题 I have the following selectize.js : $("#abc").selectize({ valueField: 'name', labelField: 'name', searchField: ['name'], plugins: ['remove_button'], createOnBlur: true, maxItems: 10, preload: true, create:function (input){ callback({ name:'Cricket', name:'Football', name : 'Tennis'}) }, }); The html code is : <select id="abc" name="sport[]"></select> I want the Cricket , Football , Tennis to pre load, Means it should be auto loaded on page load. But the options are not loading, What am i