Quantcast
Channel: User Alexis Abril - Stack Overflow
Viewing all articles
Browse latest Browse all 43

Answer by Alexis Abril for overriding jQuery.find() function to provide extra functionality

$
0
0

I actually don't see any fault in your code. It's true the example uses the jQuery prototype("fn"), however you can manipulate $.find as well. I've basically copied the same code you provided in the following example:

var oldFind = $.find;$.find = function() {    console.log("something new.");    console.log(oldFind.apply(this, arguments));};$.find("div");

Realize, you may be executing this in a specific way. Above you have:

(function() {...})();

This makes the code within the first parens, self-executing(correct me if I'm wrong here), which may not have the intent desired if you call the contained code outside this function. A working example of the snippet above is here: http://jsfiddle.net/nuPLV/


Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>