Labs/Ubiquity/jQuery in Ubiquity: Difference between revisions

Recommand to use CmdUtils.getDocument()
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>
21

edits