Passing function name as a parameter to another function doesn't seem to work for me.
I've tried every variation from every article I can find. Currently, I have this in one js file:
function callThisPlease (testIt){
alert(testIt);
}
$(document).ready(function () {
$.fn.pleaseCallTheOtherFunction('callThisPlease');
});
I have this in another:
$(document).ready(function () {
$.fn.pleaseCallTheOtherFunction = function(functionName){
window[functionName].apply('works');
}
});
chrome console says Uncaught TypeError: Cannot call method 'apply' of undefined
.
Please help. Many thanks in advance!