ajax - JQuery within an Object -


why work

$("body").on("click",".open_popup",function(event){          event.preventdefault();          $("#form1").show();       }) 

but same code inside object,like so:

var popupformulario = {                openwith: function () {         self=this;          $("body").on("click",".open_popup",function(event){              event.preventdefault();              $("#"+self.id+"").show();             })     } 

and calling function

popupformulario.openwith()  

just wont ? don't it. can explain me ? in advance

your problem looks line: $("#"+self.id+"").show(); (which doesn't need last "", $("#"+self.id).show(), that's not issue)

self this openwith function, not have dom element id.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -