jquery - Javascript: add onclick attribute DOM -
i've tryed add listeners existing div element
//prepare div $(this.div).css("z-index","256"); $(this.div).attr("onmouseover",this.myname+".resize();"); $(this.div).attr("onmousedown",this.myname+".resize();"); $(this.div).attr("onmouseout","if("+this.myname+".sized)"+ this.myname+".resize();");
but in ie , chrome event doesn't fired while still gets added elements attributes. firefox works expected.
does know whats wrong it?
thanks
do not set events strings.
instead, should use jquery's bind
method:
var me = this; //inside handlers, element. $(this.div).bind('mouseenter mousedown mouseleave', function() { me.resize(); });
Comments
Post a Comment