Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck if jQuery and jQuery UI was loaded
    primarykey
    data
    text
    <p>Hello i need to build a 3rd Party Widgets with JavaScript and php. This Widgets will need to use in jQuery and jQuery UI and maybe in the future other jQuery Libraries and Plugins. so when my client put this Widget to his site i need to know if jQuery and jQuery UI is already loaded and if not load it my self. I built something but it not working.</p> <pre><code> &lt;script&gt; if (typeof jQuery == 'undefined') { // jQuery is not loaded //alert('jQuery is not loaded'); var script = document.createElement('script'); script.type = "text/javascript"; script.src = "http://code.jquery.com/jquery-1.9.1.js"; document.getElementsByTagName('head')[0].appendChild(script); var script_ui = document.createElement('script'); script_ui.type = "text/javascript"; script_ui.src = "http://code.jquery.com/ui/1.10.3/jquery-ui.js"; document.getElementsByTagName('head')[0].appendChild(script_ui); } else { // jQuery is loaded //alert('jQuery is loaded'); if (typeof jQuery.ui !== 'undefined') { // ui plugin exists alert('ui plugin exists'); } else { // ui plugin DOES NOT exist //alert('ui plugin DOES NOT exist'); var script_ui = document.createElement('script'); script_ui.type = "text/javascript"; script_ui.src = "http://code.jquery.com/ui/1.10.3/jquery-ui.js"; document.getElementsByTagName('head')[0].appendChild(script_ui); } } &lt;/script&gt; </code></pre> <p>This working fine but when i try to work with jQuery datepicker i get ReferenceError: jQuery is not defined.</p> <pre><code> &lt;script&gt; jQuery(document).ready(function() { // Handler for .ready() called. jQuery(function() { jQuery( "#datepicker" ).datepicker(); }); }); &lt;/script&gt; </code></pre> <p>Even without the jQuery(document).ready(function() It does not work </p> <p>Please Hellp... </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload