简体   繁体   中英

jQuery Uncaught TypeError: $(…).editRule is not a function - click event

I am totally confused and googled a lot but did not find the answer. No matter what I try, the following Code causes: Uncaught TypeError: $(...).editRule is not a function.

    functionName(){
         [...]    
         $(`#index`).unbind().click(() => {
            $(`#index`).editRule(rule);
          });
      }

      editRule (rule) {
        // do sth
      }

The reference definitely works. Other predefined functions like .remove() behaves correctly. I tried a lot (function or static, no parameter, other functions, etc.) but the error stays and I am not very experienced with the click-event. Does somebody know what the problem is?

Did you add the editRule method to jQuery using : https://api.jquery.com/jquery.fn.extend/ ? Or are you using a special jQuery library that would add editRule to jQuery's methods?

Otherwise editrule is not a jQuery method and cannot be chained like this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM