My code uses a jQuery plugin that inserts some HTML code.
I have the option to change the inserting method, by setting them via variable.
The variable is called:
var options = {insert: 'append'};
I don't want to do that with an if
condition, like that:
if(options.insert === 'append') {
$('#foobar').append(htmlcode);
}else if (options.insert === 'prepend'){
$('#foobar').prepend(htmlcode);
... and so on.
Is there any solution to insert the html code with a given varibale method?