I wish to append or prepend some html to the page.
Rather than my function going:
var action = 'prepend'; // may be prepend or append
var htmlStr = '<strong>text example</strong>';
var obj = $('#wrapExample');
if(action == 'prepend'){
$(obj).prepend(htmlStr);
}else{
$(obj).append(htmlStr);
}
Can I somehow eval the 'action' variable e.g.
eval('$(obj).' + action + '(' + htmlStr + ')');