Code: Select all
$s = "
function nuOnSetSelect2Options(i) {
return {
placeholder: 'This is my placeholder',
allowClear: true
};
}
";
nuAddJavascript($s, true);
Note that the 2nd parameter of nuAddJavascript() is set to true to add the JS before the form/objects are created.
Here is a list of all the Select2 configuration options:
https://select2.org/configuration/options-api