Select2 problem,
I do not want drop down search box, i want to make first line in search,
How can i do?
How do I search by location placeholder? CODE :
<select name="search" class="box"></select>
Example pictures,
$(".box").select2({
minimumInputLength: 2,
placeholder: ' Search!',
cache:true,
ajax: {
dataType: 'json',
url: 'ajax.php',
delay: 400,
data: function(params) {
return {
term: params.term
}
},
processResults: function (data, page) {
return {
results: data.results
};
}
}
});
Thanks..
Select2 problem,
I do not want drop down search box, i want to make first line in search,
How can i do?
How do I search by location placeholder? CODE :
<select name="search" class="box"></select>
Example pictures,
$(".box").select2({
minimumInputLength: 2,
placeholder: ' Search!',
cache:true,
ajax: {
dataType: 'json',
url: 'ajax.php',
delay: 400,
data: function(params) {
return {
term: params.term
}
},
processResults: function (data, page) {
return {
results: data.results
};
}
}
});
Thanks..
Share Improve this question edited Dec 11, 2015 at 8:47 Gokul P P 9629 silver badges29 bronze badges asked Dec 11, 2015 at 8:13 umutumut 131 gold badge1 silver badge9 bronze badges 02 Answers
Reset to default 0Add the following to your CSS, make sure that it appears below the CSS for select2:
.select2-drop-active{
margin-top: -25px;
}
Here is a demo jsFiddle
Note that this will effect all of your select2 elements. To target specific elements, simply adjust the selector for the rule to suit your needs.
enter image description here $("select#currency(class or id name)").select2({ tags : true, createTag : function(params) { return undefined; } });