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
Post a Comment