views:

30

answers:

2

Dear all

every time i try using jquery dialog i get error null when debugging using firebug, here is the code

<script type="text/javascript" src="js/jquery-1.4.2.js"></script>

    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"&gt;
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"&gt;&lt;/script&gt;
      <script>
      $(document).ready(function() {
        $("#dialog").dialog();
      });
      </script>

    <div id="dialog" title="Dialog Title">I'm in a dialog</div>
+2  A: 

It could be that your jQuery.js file doesn't exist in that path. Replace it with the Google hosted one.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;

Also you should add <script type="text/javascript"></script> where your jQuery code is.

<script type="text/javascript" src="js/jquery-1.4.2.js"></script>

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"&gt;
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"&gt;&lt;/script&gt;
  <script type="text/javascript">
  $(document).ready(function() {
    $("#dialog").dialog();
  });
  </script>

<div id="dialog" title="Dialog Title">I'm in a dialog</div>
Marko
it wont effect with or without <script type="text/javascript"> in there demo it worked without http://docs.jquery.com/UI/Dialog
Mahmoud
nope the path is correct and i checked it many times
Mahmoud
I guarantee you it's your setup. Check out this sample http://jsfiddle.net/d6fAa/
Marko
your correct the problem was the jquery was crashing with another js script i just had to move up the jquery to the top thanks
Mahmoud
Excellent I'm glad you got it working
Marko
A: 

Your <link> element isn't closed. I'm guessing that it's somehow picking up and squashing the dialog div, as anything in a link tag I would presume is ignored and not placed on the DOM.

Stefan Kendall