Why am I getting too much recursion on a jQuery plugin this.each
iteration?
(function($) {
$.fn.selectableList = function(options) {
return this.each(function() {
var $this = $(this);
$this.elem = $this.children('li').click(onClick);
});
function onClick() {
//do something
}
}
})(jQuery);
Try just:
$(this).find('li').click(onClick);
Instead of the 2 lines you have there, that should not produce too much recursion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.