12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- var FormSamples = function () {
- return {
- //main function to initiate the module
- init: function () {
- // use select2 dropdown instead of chosen as select2 works fine with bootstrap on responsive layouts.
- $('.select2_category').select2({
- placeholder: "Select an option",
- allowClear: true
- });
- $('.select2_sample1').select2({
- placeholder: "Select a State",
- allowClear: true
- });
- $(".select2_sample2").select2({
- placeholder: "Type to select an option",
- allowClear: true,
- minimumInputLength: 1,
- query: function (query) {
- var data = {
- results: []
- }, i, j, s;
- for (i = 1; i < 5; i++) {
- s = "";
- for (j = 0; j < i; j++) {
- s = s + query.term;
- }
- data.results.push({
- id: query.term + i,
- text: s
- });
- }
- query.callback(data);
- }
- });
- $(".select2_sample3").select2({
- tags: ["red", "green", "blue", "yellow", "pink"]
- });
- }
- };
- }();
|