I have a JS plugin, which I want to trigger for every instance of an element.
However, I want the options for the plugin to be different for different cases.
if(something) {
var options = {
itemSelectText: 'Some text',
searchPlaceholderValue: 'Search for something'
}
} else {
var options = {
itemSelectText: 'Some other text',
searchPlaceholderValue: 'Search for something else'
}
}
const choices = new Choices(dropdown,
options
);
Is this possible?
>Solution :
let options = {};
if(something) {
options = {
itemSelectText: 'Some text',
searchPlaceholderValue: 'Search for something'
}
} else {
options = {
itemSelectText: 'Some other text',
searchPlaceholderValue: 'Search for something else'
}
}
const choices = new Choices(dropdown,
options
);