How to override system javascript function and still call original
This code was copied directly from Denis Ivaykin's solution for scrolling to the top of the page when the user moves through the pages of Get Quote. I thought the override code deserved it's own entry. So voila!
It overrides the function called when the user clicks the Next button but calls both the new code + original code.
var selectNextPage = (function() {
var original = selectNextPage;
return function() {
original();
scroll(0, 0);
if (console) console.log('next');
}
})();
var selectPreviousPage= (
function() {
var original = selectPreviousPage;
return function() {
original();
scroll(0, 0);
if (console) console.log('prev');
}
})();
Please sign in to leave a comment.
Comments
0 comments