I want to use select2 in the forum. how do I do it?
What I did here came out wrong
What I did here came out wrong
Code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
<script>
XF.Runselect = XF.Element.newHandler({
init: function(){
$('.js-example-basic-multiple').select2({
tags: true,
tokenSeparators: [',', ' '],
});
this.alert();
},
alert: function(){
alert('The text changed to red and underline...');
}
});
XF.Element.register('Runselect', 'XF.Runselect');
</script>
<xf:select data-xf-init="Runselect " class="js-example-basic-multiple" multiple="multiple">
<xf:option value="1">
orange
</xf:option>
<xf:option value="2">
apple
</xf:option>
<xf:option value="1">
banana
</xf:option>
</xf:select>