Labs/Ubiquity/jQuery in Ubiquity: Difference between revisions

From MozillaWiki
< Labs‎ | Ubiquity
Jump to navigation Jump to search
No edit summary
(Recommand to use CmdUtils.getDocument())
 
Line 1: Line 1:
Here's an example of using jQuery in Ubiquity:
Here's an example of using jQuery in Ubiquity:


// get the active document
<pre>
 
// get the active document in a secure way
var doc = Application.activeWindow.activeTab.document;
var doc = CmdUtils.getDocument();


// find div.foo in the body of that document
// find div.foo in the body of that document
jQuery('div.foo', doc.body);
jQuery('div.foo', doc.body);
</pre>

Latest revision as of 00:35, 9 February 2009

Here's an example of using jQuery in Ubiquity:

// get the active document in a secure way
var doc = CmdUtils.getDocument();

// find div.foo in the body of that document
jQuery('div.foo', doc.body);