-1

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.

Robusto
  • 31,447
  • 8
  • 56
  • 77
oteal
  • 614
  • 2
  • 13
  • 25

1 Answers1

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.

Community
  • 1
  • 1
GuyT
  • 4,316
  • 2
  • 16
  • 30