Overriding deep functions in javascript
Posted
by PintSizedCat
on Stack Overflow
See other posts from Stack Overflow
or by PintSizedCat
Published on 2010-04-08T21:42:23Z
Indexed on
2010/04/08
22:13 UTC
Read the original article
Hit count: 353
I'm quite new to javascript but have undertaken a task to get better aquainted with it. However, I am running into some problems with jQuery. The following javascript is the code that is in a third party jQuery plugin and I would love to be able to override the funFunction() function here to do my own implementation. Is this possible, if so, how can I do it? I've been doing a fair amount of searching and have tried a number of methods for overriding the function using things like:
jQuery.blah.funFunction = funtion() { alert("like this"); };
Main code:
(function($) {
$.extend( {
blah: new function() {
this.construct = = function(settings) {
//Construct... stuff
};
function funFunction() {
//Function I want to override
}
}
});
})(jQuery);
For those further interested I am trying to override tablesorter so that the only way a user can sort a column is in ascending order only.
Edit:
There is a wordpress installation that uses WP-Table-Reloaded which in turn uses this plugin. I don't want to change the core code for this plugin because if there was ever an update I would then have to make sure that my predecessor knew exactly what I had done.
I've been programming for a long time and feel like I should easily be able to pick up javascript whilst also looking at jQuery. I know exactly what I need to do for this, just not how I can override this function.
© Stack Overflow or respective owner