javascript - jQuery this.remove() -vs.- $('#id').remove() in Internet Explorer (IE 9+) -
javascript - jQuery this.remove() -vs.- $('#id').remove() in Internet Explorer (IE 9+) -
why this.remove()
doesn't work in ie9+?
<input type="button" value="next1" id="nextbutton1"> <br> <input type="button" value="next2" id="nextbutton2"> $('#nextbutton1').on('click', function() { this.remove(); // works in browsers ie9+ }); $('#nextbutton2').on('click', function() { $('#nextbutton2').remove(); //works in browsers });
jsfiddle live version
that's because you're using childnode.remove()
method not supported browsers.
this ---> refers node. //warning: experimental technology
jquery's .remove()
method, cross-browser , utilize have wrap this
in $(...)
this:
$(this).remove();
childnode.remove() browser compatibility
this.remove()
supported next desktop browsers:
- chrome 23+ - firefox 23+ - opera 10+ - safari 7+
javascript jquery internet-explorer
Comments
Post a Comment