Find myself writing an extension for Chrome, as a test I want to make this happen:
$(document).click(function(e) { alert('clicked'); });
But it does not work as expected, any ideas?
This is manifest.json:
"name": "Test",
"version": "0.2",
"content_scripts": [
{
"all_frames": true,
"matches": ["*://mail.google.com/mail/*"],
"js": ["jquery-1.7.2.js", "test.js"]
}
]
$(document).click(function(e) { var evt=e||window.event;if(evt.type=='click')alert('clicked'); });
Here is what you are missing!
I think you should use .on()
it worked for me. Simple example: $(document).on("click",function(){alert("clicked")});
For all options of .on
look here http://api.jquery.com/on/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.