I’m using the code below to initialize select2 on all select elements where the name contains activities. I’m having to do this because I have no control over the data that is output.
$("select[name^='activities']").select2({
width: '100%',
});
I have a button the will add a new tr that contains the select fields. When the new row is added the select fields are disabled/greyed out.
I’ve tried to initialize select2 on the click of the button that adds the new row but that didn’t work.
$( ".add" ).click(function() {
$("select[name^='activities']").select2({
width: '100%',
});
});
Is there a way to get to select2 load on a button click.
Thanks
Wayne.