I'm trying to hack my way around some Opentext forms and I've created and array below containing my select2 objects. How do I use the array index of the object that has triggered an event? Or is there a better way to do this?
The joblink variable is a hidden element that stores a value written and read by opentext
for(var b = 0; b <= 15; b++){
JobSelect[b] = $('#Job' + (b + 1) + 'Trans').select2({ width: '100%', Height: '100%' }).on('change', function(e){
$(joblink[b]).val(this.value);
});
if ($(joblink[b]).val() != '')
{
$(JobSelect[b]).val($(joblink[b]).val()).trigger("change");
}
}