I have to call Jquery functions using a variable value.
Let consider below scenario:
var func = "append";
$(document).func("<div>Append Welcome</div>");
func = "prepend";
$(document).func("<div> Prepend Welcome</div>");
func = "html";
$(document).func("<div> Insert Html Welcome</div>");
I can use if and else but is there any way to achieve as above.
Is this a good way to do or simply use if and else?
$(document)[func]("<div>Append Welcome</div>");