replaceWith(fn) undocumented #409

Closed
bebraw opened this Issue Mar 6, 2014 · 0 comments

Projects

None yet

1 participant

@bebraw

It looks like replaceWith actually can accept a function. In that case it will work like this:

var a = $('a');
a.replaceWith(function(i) {
    return $(a[i]).text();
});

As you can see the function receives the index of the matched element. It would be even handier if the element would be passed to the callback as a second parameter. Then you could avoid a hack like above.

It would be nice if you could either document the usage or improve it as suggested above.

@davidchambers davidchambers closed this in #410 Mar 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment