Error while calling function inside another one

Error while calling function inside another one

I’m having a hard time trying to call functions from inside other functions:

  1. $('#edit_wgt_contact_form').modal(); //Widgets creation 
  2. function createWidget(type){ 
  3.       $('#edit_wgt_contact_form').modal(); 

The first call to "$('#edit_wgt_contact_form').modal()" works as expected but the one inside the function returns an error "$("#edit_wgt_contact_form").modal is not a function".

(of course the createWidget function is being called in other part of the script).

This is just an example, I'm having the same kind of problem in different parts of my application and I just can't figure out what's going on.

Can someone please help?

Thanks in advance!