draggable is not a function

draggable is not a function

Hi everybody!
I developed a script some weeks ago using jQuery UI and now I'm going to create it's the new version.
The problem is that if I import jQuery UI from Google Developers CDN or from local (loaded into the server), draggable function returns in Chrome

" Uncaught TypeError: undefined is not a function script1.0.js:17(anonymous function) script1.0.js:17 "

or, in Firefox 31,

" TypeError: $(...).draggable is not a function "

The script, 'til now, check if jQuery and jQuery are available by Javascript-Pure code. Else it import them.
Then I append the jquery-ui.min.css and my css file. Then I must let all the elements being draggable... and there's the error.
Here below the script:

  1. function inc(url){ var body=document.getElementsByTagName("body")[0],
  2. js=document.createElement("script");
  3. js.type="text/javascript";
  4. js.src=url;body.appendChild(js);
  5. }
  6. if(!window.jQuery){  console.log("jQuery missing. Importing from Google Developers ( https://developers.google.com/speed/libraries/devguide#jquery).");
  7. inc("//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js");
  8. }
  9. if(!jQuery.ui) {
  10. console.log("jQuery UI missing. Importing from Google Developers ( https://developers.google.com/speed/libraries/devguide#jquery-ui).");
  11. inc("//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js");
  12. }
  13. /* Script Start */
  14. $("head").append("<link rel='stylesheet' type='text/css' href='position.css'/><link rel='stylesheet' href='//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css'/>");
  15. console.log("Imported 'position.css' from the using hosting\nImported 'jquery-ui.css' from Google Developers ( http://developers.google.com)");

  16. $("*").draggable();


Does someone know why i get this error?
Thank at all.



EDIT - SOLVED:

I solved with this:

$(function() {
      $("*").draggable();
});

But it was written nowhere in documentation.