Is it possible to set different select2 parameters at different times?
Posted
by
ReiMasuro
on Stack Overflow
See other posts from Stack Overflow
or by ReiMasuro
Published on 2014-06-13T09:21:00Z
Indexed on
2014/06/13
9:24 UTC
Read the original article
Hit count: 183
jQuery
|jquery-select2
From playing around I can see that this code
$("#Selected3").select2({ minimumInputLength: 3 });
$("#Selected3").select2({ placeholder: "Show a placeholder" });
will show me the placeholder but remove the minimumInputLength parameters value.
Does anyone know a way please that this example could be modified so that the placeholder will be added without losing the minimum..Length value.
Any answers will need to allow for the possibility of the statements being in separate files, i.e. one on the page and another in a referenced .js file.
I am aware that this would be much easier if I set all the parameters at once, e.g.
$("#Selected3").select2({
minimumInputLength: 3,
placeholder: "Show a placeholder"
});
but I am working within a framework which won't currently allow that.
EDIT: For anyone who is willing to give this a shot but doesn't know select2 the library comes from here Select2 on GitHub
© Stack Overflow or respective owner