How to call internal functions of a plugin?

How to call internal functions of a plugin?

Hi there!

Firstoff: I know I ask about using a plugin, and I wasn't so sure where to put my question in, decided though the general jQuery-Forum would be better as my problem is more connected to jQuery than the plugin itself.

First off, I'm using this plugin and modified it myself a bit, adding new functions:
http://www.quasipartikel.at/multiselect/
You'll find the underlying .js for the component here:
http://www.quasipartikel.at/multiselect/js/ui.multiselect.js

Now, scroll to the end of the file, you'll find some "internal functions" like
_registerRemoveEvents

I defined such functions myself, for example something like this:


  1. _clearAvailableList: function() {
  2.       var that = this;
  3.       that.availableList.children('.ui-element').remove();
  4.       that.element.find('option').remove();
  5. }
The call of this function works perfectly inside the .js file,
when I call it like this:

this._clearAvailableList();


What I want to do now is calling this function from the original html page,
with a button or so.









  1. <script type="text/javascript">
  2. function test()
  3. {
  4. //var mycomponent = $(".ui-multiselect");
  5. //mycomponent._clearAvailableList();
  6. _clearAvailableList();
  7. }
  8. </script>

  9. <input type="button" value="Click me!" onclick="test()" />

Unfortunately this doesnt work, and I dont know why.
I suppose, its because I just select the graphical represantion with .ui-multiselect,
but it's not the same as "this" in the internal .js-file.
mycomponent.hide() for example just works fine (of course).

How do I refer to "this" from the .js context / how can I call the internal functions from a component?


Thanks in Advance,
deadcode