Created
October 17, 2018 09:51
-
-
Save postman31/e84dcc621cd08bb6f977c2fd52386649 to your computer and use it in GitHub Desktop.
training push override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someArray = [] | |
someArray.push = function (element){ | |
//Do what you want here... | |
if (element) { | |
console.log (element) | |
} | |
return Array.prototype.push.apply(this,arguments); | |
} | |
document.addEventListener('submit', function(e) { | |
someArray.push(e.target.id || 'unknown form') | |
console.log('submitted') | |
e.preventDefault() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment