views:

45

answers:

1

Hi,

I'm migrating some old code to jquery:

 xmlHttp.onreadystatechange = function() {
  if (xmlHttp.readyState == 4) {
   $("#" + ajaxArea).html (xmlHttp.responseText);

   $("#" + ajaxArea).attr('title', 'Login');
   $("#" + ajaxArea).dialog({
    height : 140,
    modal : true
   });
  }
 };

where ajaxArea is the ID of a DIV in the HTML.

The dialog bit is basically adapted from the jQuery example here: http://jqueryui.com/demos/dialog/#modal

All of it works fine up until the last line. Firefox throws an error that simply says "$(" for that line. Anyone know what might be causing this?

+2  A: 

The jQuery UI code is separate from "core" jQuery. You can import both into your application from Google's servers:

You can alternatively build your own custom jQuery UI package, which will be smaller (but not hosted at Google). That's done at the jQuery UI site itself: http://jqueryui.com/download

As a style note, it's good to get in the habit of using jQuery's "chaining" style:

$("#" + ajaxArea).html (xmlHttp.responseText)
  .attr('title', 'Login')
  .dialog({
    height : 140,
    modal : true
  });

It saves some work, esp. when the selector is complicated.

Pointy
The links in my answer here are out of date. Check http://code.google.com/apis/libraries/ for the real beef.
Pointy