2

I'm trying to use jquery draggable ui , but it seems like the ui is not well imported

I'd run this test :

if(jQuery.ui){
    alert("loaded");
        }
    else
    {
        alert("not loaded");
    }

And got an "not loaded" alert....

Here are the first code lines of the file i'm writing :

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
    <?php
    $searchQuery = $_POST['searchQuery'];
    ?>

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

Any idea what might went wrong ?

*I'm already using another jQuery functions which work just fine , so the jquery package is imported for sure , I gurss the problem is the ui import did not success.

5
  • Your code seems correct. Can you check in your browser's dev tools what is the return status of jQuery UI request? Commented Aug 5, 2012 at 13:38
  • check javascript console for errors Commented Aug 5, 2012 at 13:40
  • Why are you loading such an old version of jQuery? There may be a clash between your newer jQueryUI library and the older main library. Commented Aug 5, 2012 at 13:40
  • may be noscript blocks ajax.googleapis.com ? Commented Aug 5, 2012 at 13:40
  • jQuery UI page says: The current versions are: jQuery UI 1.8.22: Works with jQuery 1.3.2+ jQuery UI 1.7.2: Works with jQuery 1.3.2+ - so that should work. Commented Aug 5, 2012 at 13:43

2 Answers 2

2

Try

if (jQuery.ui || jQuery.ui != "undefined") {
    alert("loaded")
}

You can always just try to load a random UI item (pulled from jQuery ui website) HTML

<div id="accordion">
    <h3><a href="#">First header</a></h3>
    <div>First content</div>
    <h3><a href="#">Second header</a></h3>
    <div>Second content</div>
</div>

JavaScript

$("#accordion").accordion();

If the HTML block doesn't show up as an accordion element, then it isn't loaded.

Sign up to request clarification or add additional context in comments.

Comments

0

Try this :

  $( function() { $("#accordion").accordion();} );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.