Maybe FF supports method getParent directly, IE have not this method. function $() creats it for IE
On Fri, Jan 15, 2010 at 5:12 PM, silent <[email protected]> wrote: > hi list, > > I found this piece of code works different in IE6 and firefox3.5: > > function hook(el) { > // var sub_id = $('sub_id'); // use this will ok in two browsers > var sub_id = el; // if use this, next line will fail in IE6, but > works in firefox3.5 > > var el2 = sub_id.getParent(); > alert(el2); > return false; > }; > <input type="submit" id="sub_id" onclick="hook(this)" value="click"/> > > though at last I find out use "var sub_id = $(el)" also work, > but could someone give me a describe on this problem ? > > thanks! >
