Added new replaceWith() (replace all matched elements with the specified HTML/DOM...
[jquery.git] / src / jquery / jquery.js
index 4c5941b..8988c5e 100644 (file)
@@ -1182,6 +1182,10 @@ jQuery.fn = jQuery.prototype = {
                        this.empty().append( val );
        },
 
+       replaceWith: function( val ) {
+               return this.after( val ).remove();
+       },
+
        slice: function() {
                return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
        },
@@ -2227,7 +2231,8 @@ jQuery.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
-       insertAfter: "after"
+       insertAfter: "after",
+       replaceAll: "replaceWith"
 }, function(i,n){
        jQuery.fn[ i ] = function(){
                var a = arguments;