Guy Guy - 1 year ago 97
Javascript Question

jquery selector not working in Gmail

I'm using Jquery to modify the Google navigation toolbar (the black one).

This selector works on and some other google sites like Google Plus (


(this selects the li items in the toolbar)

But for some reason, inside gmail, this selector doesn't work. The structure of the page seems exactly the same on and in the other google sites, but this selector doesn't return anything when run in gmail.

Any ideas?

Answer Source

The contents(including the toolbar) of Gmail unlike other google-pages are loaded within an iframe.

So when you use this code from the top-document you must pass the iframe-document as context(2nd argument for $() )

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download