Is it possible add some function to jquery functions like hide() or show()? The objective is always that I use the function hide(), it will execute jquery base and my own function. If yes, can you show me how? Thanks.
Asked
Active
Viewed 65 times
1 Answers
2
You could override the function. Check Override jQuery functions for a more detailed answer.
Edit:
jQuery.fn.show = function() {
// Your custom code
}
But I wouldn't override jQuery's methods when you could create your own. Overriding would very likely cause unexpected behavior in plugins.
-
I was just about to write this out by hand, not knowing that solution existed. – crush Jan 24 '14 at 16:17