Calling local function with Jquery

Posted by Bug Magnet on Stack Overflow See other posts from Stack Overflow or by Bug Magnet
Published on 2010-12-26T12:48:29Z Indexed on 2010/12/26 12:54 UTC
Read the original article Hit count: 253

Filed under:

I have a JQuery function as followss:

(function($){
$.fn.autoSuggest = function(data, options) {

    function add_selected_item(data, num){
        (function($){
            $.fn.autoSuggest = function(data, options) {
                alert(data);
          }
        });
    }

});

If I wanted to call the local add_selected_item() function from outside this function, how would I do it?

I've tried doing:

$.autoSuggest.add_selected_item(data, opt);

But am getting an $.autoSuggest is undefined.

Still learning the ropes with JQUery. I am not sure exactly how this can be accomplished, if at all.

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery