I have written some JavaScript that opens an element when an element is clicked. However I can’t get the: This is not working to how I want it because: You can open more than one of the showed elements when I only want one open at a time. When I click inside the element it closes, I only want it
Tag: dom-events
Event listener for html5 details node state change
I am trying to add an event listener to detect a change in the state of an HTML5 details node. Initially I tried attaching a listener to the open and close events as it makes logical sense to me for a details node to have those listeners, but it doesn’t and I do not see any mention of them in
Detect if HTML5 Video element is playing [duplicate]
This question already has answers here: How to tell if a <video> element is currently playing? (7 answers) Closed 1 year ago. I’ve looked through a couple of questions to find out if an HTML5 element is playing, but can’t find the answer. I’ve looked at the W3 documentation and it has an event named “playing” but I can’t seem
Which events are the most intensive?
Which events are the most resource intensive to have attached? Is a mouseover “worst” than a click? Are there any events that are known to be really harsh on the browser? I have my sights on IE7 mainly, as we are seeing performance issues there. We use event delegation where we can. Or, how can I profile events which are
Deactivating and activating an E-mail form
I’m trying to get the code below to keep an E-mail form deactivated until 6 seconds after the page is fully loaded. What can I do to make it work like that? Answer It is not a good idea to hard code the duration. Instead you should call the activate using asynchronous call. Anyways, here is the working code.
Confused with syntax, calling a JS function with an input button
I am having troubles understanding the xhtml syntax for calling a function with an input button. I have searched for this, but cannot find a clear explanation. This snippet of code is from my book, and it works ok, but I’m not sure exactly how the following line works: From what I can figure out, gradeForm is the form, and
In JavaScript, manually controlling order of event listeners
Assuming that FORM contains INPUT, have the following listeners: JavaScript Desired order of firing Nature of problem and attempted solutions Own code at FORM level, formFirst, formLast and middle, but have no access to INPUT code, inputFirst and inputLast – although could add own listeners on the INPUT. Attempt 1 modify formFirst() to create and dispatch a new change Event
Actual key assigned to JavaScript keyCode
I have setup an event listener: When the user presses 2 along with shift, how do I know if I should output (@) or (“)? Each users’ character mapping is different per locale. Answer Use the keypress event instead. It will reliably (barring a few edge cases) detect the character typed. There are a few browser oddities (such as some
Why is event.ctrlKey returning undef?
I am calling a JavaScript function when an option is selected in a select element like so: The function does something like this: According to the alert, e.ctrlKey is undefined – I thought this was supposed to return either true or false? What am I missing here? Answer As per the standard, the attribute ctrlKey is only available on MouseEvents
event.target on Firefox
Works fine on Google Chrome and IE but not on Firefox. Tried it on Google. Google says event.srcElement (works on IE but not on Firefox) so I have added event.target but still not working. Is there anymore changes I need to do to work on Firefox? By the way I’m using 3.5 version of Firefox. Please help me to make