Category "dom-events"

Should I use event delegation, to be economical with JS-events at i.e. table cell level?

If I have a table in which I want to react to table-cell events, is it better to put the event on the table-element and handle cell specific events with the hel

How to disable "Leave site?. Changes you made may not be saved" pop up in angular?

I'm trying to close the browser after I have reached a order confirmation page and it throws a alert as shown below. This creates a misconception to user that h

Do not close window after clicking 'X' button? [duplicate]

I want to show a dialog when users click the X button to close the browser's window. In the dialog, it will ask users if they want to proceed

overflow:hidden can't hidden skew dom event?

I created a diamond through the sketch of CSS, which is located in the upper left corner of a circle. I set overflow: hidden for the circle. How can the diamond

Why window.closed is set to true before the window is closed?

I am trying to use the answer at https://stackoverflow.com/a/48240128/583363. Open a window with window.open and then start an interval to check if it is closed

Iterate elements and toggle using classList in javascript

Conditions: Please use javascript and classList property to invert which elements have .highlight class. Basically iterate over all the <li> elements and

Observing DOM changes, Specifically input value change using Plain JavaScript [duplicate]

I have a certain requirement where I want to be notified about all changes in HTML input on a page specifically value of all input elements on

How to detect partially filled HTML date input

Using input type="date" on Chrome, client wants to flag a field if date is partially filled, ie: 01/23/yyyy (but not if it is empty). However, Chrome only seems

How to detect partially filled HTML date input

Using input type="date" on Chrome, client wants to flag a field if date is partially filled, ie: 01/23/yyyy (but not if it is empty). However, Chrome only seems

How to fire a focusin event in a crossbrowser way?

I've found very hard to manually trigger a focusin event using just Javascript (no jQuery) for it for a test suite. Apparently when the browser does not have th

JavaScript form script works Chrome but nowhere else

2nd update 9/6/2015 So here's what I came up with for a solution—it's certainly much shorter, and works in all my Mac browsers so I'm assuming it works el

Bind event with form in JavaScript

I am creating form using JavaScript. Like below var form = document.createElement('form'); form.action = 'abc.com'; form.noValidate = true; form.id = 'myForm';

How to differentiate between JavaScript submit and manual submit (for forms I don't own)

My question is almost the same as this one. But I have to ask the question again because I can not accept the answer that the OP there has seem to accept. I l

Javascript firing function twice and 1 of 4 functions not working

I'm creating a calculator in JavaScript. It is working, except for the add() function (sub, mult, and div work fine) and when I press "=" it sends the answer t

How can setTimeout save and load data back to form inputs if browser crashes, and I visit that same page again?

How can setTimeout save and load data for select form inputs? I tried to get it working with event listeners. I checked the capture and bubble which I am still

JavaScript code displaying in browser when form submitted, not the result of the script

I'm writing a basic calculator in JavaScript, and when I hit "=" on the html form it is returning the entire calculator.js, not the result. I'm not sure why th

How to attach a keyup event to Custom Element shadowRoot

I have searched for some time; but only find Polymer answers; or answers where EventListeners are put on DOM elements inside the shadowRoot. The effect I am try

In HTML, with JavaScript, create new radio button and its text?

I want that when the "Yes" radio button of a form (form1) is checked, a new form (form2) appears, with two radio buttons and their text "Yes" and "No". With an

Moving a value into an html form field

I am very new to JavaScript and would like to know how to go about the following. I have a form that I am using for entry to a fishing contest. It contains fiel

My button needs to update after an input field

I have the following problem, I made a form using HTML with some input fields. I also made the submit button disabled using the following JS code: if(document