javascript-events

Why doesn't window.addEventListener('scroll', this.someScrollHandler, false) work on IE 10?

久未见 提交于 2020-07-06 11:56:34
问题 I'm currently building a React app with a scroll handler for loading more data in an infinite scroll component. I'm using window.addEventListener('scroll', this.someScrollHandler, false); (with throttling), which works on every browser except for IE — no event is handled. In fact, testing in the IE console, the below code, then scrolling, results in no logging: window.addEventListener('scroll', function() { console.log('testing') }, false); What's going on with scroll events and IE? 回答1: My

Which jQuery events do not bubble?

半世苍凉 提交于 2020-06-27 17:29:06
问题 Pretty straightforward, I've been searching high and low for a comprehensive list of all jQuery events that do not bubble but I have been unable to find one. For example I am looking for events like image.load , XMLHttpRequest.error , etc. 回答1: The docs for jQuery's on() method says this (under "Additional Notes"); The focus and blur events are specified by the W3C to not bubble, but jQuery defines cross-browser focusin and focusout events that do bubble. When focus and blur are used to

Chrome Extension - Trigger events on content_scripts using JQuery

♀尐吖头ヾ 提交于 2020-05-12 20:00:27
问题 I wrote a Chrome Extension that automatically fills some registration forms. There are some select fields that need to be triggered on " change " event in order to start some Ajax calls. First I use JQuery attr or val to change the value of the select field, and than I use .trigger to invoke the "change" event, but this last one doesn't work. Example: I want to select the option that contains the word "London" and invoke the change element in order to start some operations of the native code

Chrome Extension - Trigger events on content_scripts using JQuery

痞子三分冷 提交于 2020-05-12 19:59:08
问题 I wrote a Chrome Extension that automatically fills some registration forms. There are some select fields that need to be triggered on " change " event in order to start some Ajax calls. First I use JQuery attr or val to change the value of the select field, and than I use .trigger to invoke the "change" event, but this last one doesn't work. Example: I want to select the option that contains the word "London" and invoke the change element in order to start some operations of the native code

Advantages of script tag before closing body tag when using events [duplicate]

本秂侑毒 提交于 2020-04-11 04:47:52
问题 This question already has answers here : Where should I put <script> tags in HTML markup? (22 answers) Closed 5 years ago . These days it seems like people recommend placing the script tag just before the closing body tag as such.. <script src="//javascript.js"></script> </body> </html> If you are running the script immediately, this is a good thing because most of your DOM has mostly loaded. However, what if you are using the onload or DOMContentLoaded events to call your main script? In

addEventListener not triggering when used in a chrome extension

瘦欲@ 提交于 2020-04-08 10:32:15
问题 I'm trying to make a chrome extension that will search different cache databases for a given page. However, it's not working as I expect it to. <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> var x; var img = document.getElementsByTagName("img"); for(x in img) { img[x].addEventListener('click',openPage, false); } function openPage(event) { alert("clicked"); var e = event.target; switch(e.alt) { case "WayBack Machine": chrome.tabs.update(tab.id, { url: "http://wayback.archive.org

addEventListener not triggering when used in a chrome extension

╄→гoц情女王★ 提交于 2020-04-08 10:31:30
问题 I'm trying to make a chrome extension that will search different cache databases for a given page. However, it's not working as I expect it to. <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> var x; var img = document.getElementsByTagName("img"); for(x in img) { img[x].addEventListener('click',openPage, false); } function openPage(event) { alert("clicked"); var e = event.target; switch(e.alt) { case "WayBack Machine": chrome.tabs.update(tab.id, { url: "http://wayback.archive.org