Can jQuery be used inside a Dreamweaver extension?

Can jQuery be used inside a Dreamweaver extension?

Hi. This is a tough nut to crack: Is it possible to use jQuery in a Dreamweaver extension? These extensions use the following syntax to reference the extension and the actual document which the extension will modify:

  1. document.forms[0].elements[1]   // refers to the extension file's form element
  2. var dom = dw.getDocumentDOM();  // gets the DOM of the current document 
    var
    firstImg = dom.images[0];
    firstImg
    .src = "myImages.gif";
You can have SCRIPT library tags in an extension file (which is a *.htm file), so we should be able to include the jQuery library for use. The trick is how to reference the current document DOM and the extension's DOM to get a handle on various objects in the extension and the current doc. Anyone have any thoughts or solutions?

I've tried using this syntax with jQuery 1.4.2 included in the extension file as a linked JS library:

  var currentDom = document.forms;
  var dwDom = dreamweaver.getDocumentDOM();
 
  alert($(currentDom));
  alert($(dwDom));

It throws this error when I try to run the extension from Dreamweaver:

  1. ---------------------------
  2. Dreamweaver
  3. ---------------------------
  4. The following JavaScript error(s) occurred:
  5. At line 33 of file "C:\Program Files\Adobe\Adobe Dreamweaver CS5\Configuration\Objects\SPRY\jquery-1.4.2.min.js":
  6. s.createElement is not a function
  7. ---------------------------
  8. OK  
  9. ---------------------------

Thanks.