javascript - Is it not a right way to call my obj function? -


i have function return object. in object have 2 function show popup , close it. works within parent function, it's not out side.. not right way call that.. else how can call obj function out side?

my function :

var popuphandler = function(handler,msg,popup){      msg =  msg == "help" ? "help" : "results"     $(handler).click(function(){         popobj.showpop(); //works     })     $('.cls-how2play').click(function(){         if(msg == 'help') popobj.closepop(); //works     });      var popobj = {         showpop  : function(){                     if(!(popup).is(':visible')) $(popup).fadein().children().find('.'+msg).show().siblings().hide();                 },         closepop : function(){                     $(popup).fadeout()                 }     }     return popobj; } 

from calling ouside :

 $('.ui-footer').click( function(){    var closeit = popuphandler();    closeit.popobj.closepop() }) //not works.. why? } 

any 1 can me right way call obj functions outside of returning function?

thanks.

as returning popobj, closeid 2 functions, not wrapped in popobj object. therefor call function so, without popobj:

closeit.closepop(); 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -