does anybody know, how would i call a inner function of main function

Ali8
Member

does anybody know, how would i call a inner function of main function

Post By Ali8 » 11 December 2016, 00:23

does anybody know, how would i call a inner function of main function for E.g in HTML: onclick='func2()'; javascript: function(){ blah blah blah; function func2(){ // i want to call this function in onclick() blah blah blah blah2; } }
Sayeed
Member

Re: does anybody know, how would i call a inner function of main function

Post By Sayeed » 11 December 2016, 13:00

Just for a quick shot, you can try this... ?? :) (Note: Here func1 should have nested functions only; else rest of its codes will also execute). In JS: ? function func1() { function func2(){ alert("Hey there!!"); } func1.func2 = func2; } ---------------------------------- And in HTML: ? -------------------------------- Tell me how it goes... :)
Sayeed
Member

Re: does anybody know, how would i call a inner function of main function

Post By Sayeed » 11 December 2016, 13:03

Whilst, this might be a better option, to call the nested function only... ?? In JS: ? var func1 = (function() { console.log(5+4); this.func2 = function(){ alert("Hey there!! " + (1+3)); }; }); var obj1 = new func1(); ---------------------------------- And in HTML: ? -------------------------------- Tell me how this one goes... :)