Reputation: 9057
I'm using an onLoad event on a Firefox extension to detect each time a page is loaded and display a Javascript alert (first example on https://developer.mozilla.org/en/Code_snippets/On_page_load).
I realized it doesn't work well with Google search engine (i.e. If you change your keyword and display a new search there isn't a new Javascript alert displayed).
Does someone know how to make the alert appear each you type one or several keyworks and press "Enter" or click on "Search" ?
Upvotes: 0
Views: 448
Reputation: 9057
A simple solution is to use the event "change" in the event listener !
Upvotes: 0
Reputation: 8729
Well, you can look for the keyup
/keydown
event on the search form and filter for Enter (13). And you can watch the click
event on the search button(s). That should do what you want, although it would mean pretty tight coupling with Google search, so you would have to update your selector/logic every time Google makes a change to their page.
Upvotes: 1