How can I dynamically make a select2 combobox read-only?
Here\'s what I\'ve tried so far:
$(\'...\').attr({\'reado
See: http://select2.github.io/select2/
I did it with:
$("#modelname-fieldname").select2({disabled:readonly});
Where:
modelname-fieldname
is as in: $form -> field($modelname, "fieldname") -> widget(Select2::classname(), [ ... ]);
readonly
is true, false or a string readonly
Optionally you can change the cursor when hovering over the select2
field.