tagged [dom-events]

How can I get the scrollbar position with JavaScript?

How can I get the scrollbar position with JavaScript? I'm trying to detect the position of the browser's scrollbar with JavaScript to decide where in the page the current view is. My guess is that I h...

7 May at 20:19

How to watch input buttons with specified name?

How to watch input buttons with specified name? For example I have long list of buttons: `` But instead of putting call to the same function in every button it would be more rational to add a single l...

6 Jan at 10:9

JavaScript inside an <img title="<a href='#' onClick='alert('Hello World!')>The Link</a>" /> possible?

JavaScript inside an The Link" /> possible? So I've got some specific question.. I already know that I can work with attributes inside a TITLE attribute.. But can I work with events inside a TIT...

3 Sep at 17:32

How to simulate a mouse click using JavaScript?

How to simulate a mouse click using JavaScript? I know about the `document.form.button.click()` method. However, I'd like to know how to simulate the `onclick` event. I found this code somewhere here ...

How to detect responsive breakpoints of Twitter Bootstrap 3 using JavaScript?

How to detect responsive breakpoints of Twitter Bootstrap 3 using JavaScript? [Currently](http://twbs.github.io/bootstrap/css/#grid-media-queries), Twitter Bootstrap 3 have the following responsive br...

How to tell which row number is clicked in a table?

How to tell which row number is clicked in a table? I have a table like the following: When a user clicks on the table, how can I get the index of this row (`tr` element)? For example, when I click on...

JavaScript click event listener on class

JavaScript click event listener on class I'm currently trying to write some JavaScript to get the attribute of the class that has been clicked. I know that to do this the correct way, I should use an ...

3 Sep at 08:32

How to fire a change event on a HTMLSelectElement if the new value is the same as the old?

How to fire a change event on a HTMLSelectElement if the new value is the same as the old? I have the following markup: When a user pulls down the combobox and selects the same option that was previou...

Getting the ID of the element that fired an event

Getting the ID of the element that fired an event Is there any way to get the ID of the element that fires an event? I'm thinking something like: ```

26 Jun at 20:38

Detect Click into Iframe using JavaScript

Detect Click into Iframe using JavaScript I understand that it is not possible to tell what the user is doing inside an `iframe` if it is cross domain. What I would like to do is track if the user cli...

How to remove all listeners in an element?

How to remove all listeners in an element? I have a button, and I added some `eventlistners` to it: ``` document.getElementById("btn").addEventListener("click", funcA, false); document.getElementById(...

Adding an onclick event to a div element

Adding an onclick event to a div element I saw a few similar topics which did help but I have specific problem and didn't manage to solve it alone so if anyone can help out I would appreciate it I wan...

9 Nov at 15:48

How to know whether refresh button or browser back button is clicked in Firefox

How to know whether refresh button or browser back button is clicked in Firefox How to know in Firefox whether refresh button is clicked or browser back button is clicked... for both events `onbeforeu...

Firing a Keyboard Event in Safari, using JavaScript

Firing a Keyboard Event in Safari, using JavaScript I'm trying to simulate a keyboard event in Safari using JavaScript. I have tried this: ...and also this: ``` var event = document.createEvent("UIEve...

How do you log all events fired by an element in jQuery?

How do you log all events fired by an element in jQuery? I'd like to see all the events fired by an as a user interacts with it. This includes stuff like: > 1. Clicking on it. 2. Clicking off it. 3. T...

9 Sep at 09:46

HTML <input type='file'> File Selection Event

HTML File Selection Event Let's say we have this code: which results in this: ![image showing browse and upload button](https://i.stack.imgur.com/bT2hc.png) When the user clicks the 'Browse...' but

28 Aug at 14:54

How can I trigger an onchange event manually?

How can I trigger an onchange event manually? I'm setting a date-time textfield value via a calendar widget. Obviously, the calendar widget does something like this : What I want is: On changing value...

How to add an onchange event to a select box via javascript?

How to add an onchange event to a select box via javascript? I've got a script where I am dynamically creating select boxes. When those boxes are created, we want to set the `onchange` event for the n...

25 Oct at 18:34

React onClick function fires on render

React onClick function fires on render I pass 2 values to a child component: 1. List of objects to display 2. delete function. I use a .map() function to display my list of objects(like in the example...

How to find out which JavaScript events fired?

How to find out which JavaScript events fired? I have a select list: When I select `Closed` the page reloads. In this case it shows closed tickets (instead of opened). It works fine when I do it manua...

addEventListener, "change" and option selection

addEventListener, "change" and option selection I'm trying to have dynamic select list populate itself, from a single selection to start: and then JavaScript code we have: The problem is that various ...

18 Oct at 16:45

How to block users from closing a window in Javascript?

How to block users from closing a window in Javascript? Is it possible to block users from closing the window using the exit button ? I am actually providing a close button in the page for the users t...

9 Sep at 16:22

Prevent onmouseout when hovering child element of the parent absolute div WITHOUT jQuery

Prevent onmouseout when hovering child element of the parent absolute div WITHOUT jQuery I am having trouble with the `onmouseout` function in an absolute positoned div. When the mouse hits a child el...

25 Aug at 10:4

Get ID of element that called a function

Get ID of element that called a function How can I get the ID of an element that called a JS function? is an image of a dog as the user points his/her mouse around the screen at different parts of th...

24 Aug at 16:27

Is there an onSelect event or equivalent for HTML <select>?

Is there an onSelect event or equivalent for HTML ? I have an input form that lets me select from multiple options, and do something when the user the selection. Eg, Now, `doSomething()` only gets tri...