Using a placeholder and clearing the select2

Hi folks,

tried to set a place holder for my select2:

AJS.$("#select-connections").auiSelect2({
        placeholder: "Select a Connection",
        allowClear: true
    });

This however does not work and select selects the first option automatically…

Second I tried to clear the selected option in js:

$('#select-connections').val(null).trigger('change');

As well did not work.

Any hints how to do it?

Thanks!

Ok. Seems I have found a solution. No problem with implementation. To add a placeholder you have to include in your html velocity template a empty <option> first.