if (jQuery && !jQuery.fn.forEach) {
$(function () {
(function ($) {
$.fn.extend({
forEach: function (predicate) {
if (this == null) {
throw new TypeError(' this is null or not defined');
}
// 1. Let O be the result of calling toObject() passing the
// |this| value as the argument.
var O = Object(this);
// 2. If isCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== "function") {
throw new TypeError(predicate + ' is not a function');
}
//3 call the jq original API for iteror
$.each(O, function (index, domEle) {
predicate($(domEle));
});
}
})
})(jQuery);
});
}