Most voted "javascript-events" questions
None
Learn more…279 questions
Sort by count of
-
9
votes4
answers701
viewsHow to create and use custom events
Researching I found Event and CustumEvent, both can be used to create events, and to control registrations, removals and emissions of the event should be used EventTarget, but I didn’t understand…
-
8
votes2
answers357
viewsEventos Bubbles Javascript
What a Javascript Bubble Event means? I couldn’t understand the meaning and use of the Bubbles events. Following the W3schools reference: https://www.w3schools.com/jsref/event_bubbles.asp Could you…
-
7
votes1
answer768
viewsHow do I get the message/details with addeventlistener("error")?
When I define true in the parameter useCapture: addEventListener(type, listener[, useCapture]); I can catch any mistake, however I can’t get the details of error, see:…
-
6
votes2
answers52
viewsHow to allow the click event to be ignored by clicking inside an element?
I have a div which contains some child elements. I would like you to click on the window, that one div be removed. The code below served, however, by clicking on the content inside the div, she…
-
5
votes1
answer280
viewsWhat’s the difference between this, Event.target and Event.currentTarget in the scope of an event?
What’s the difference between this, Event.target and Event.currentTarget in the scope of an event? var elem = document.getElementById("meuId"); elem.addEventListener("click", function (event) {…
-
5
votes5
answers4681
viewsHow to make a Rigger for a SEM jQuery event?
In jQuery, when I want to make a Rigger for an existing event, I do so: $(function (){ $('#button').on('click', function () { console.log('olá mundo'); }); $('#button').trigger('click'); })…
-
5
votes1
answer194
viewsHow is the scope of an Event Listener defined in any attribute in HTML created?
According to the documentation, when the Listener event is assigned as an HTML attribute, the specified code (in the attribute value) is wrapped in a function, with the following parameters: event -…
-
4
votes2
answers54475
viewsPlace Javascript function inside onclick
So it’s kind of a silly question, but I really need... has how I put a Javascript function inside a buttom in this example below it calls the function loadDoc(). more I would like to put the…
-
4
votes2
answers4666
viewsRemove disabled attribute when a condition is met
Good night. I am trying to make a login and registration screen for an application that will save the data in localStorage. To prevent the user from registering with incomplete data I disabled the…
javascript jquery html5 localstorage javascript-eventsasked 7 years, 8 months ago Mauricio Hartmann 131 -
4
votes4
answers205
viewsCatch event that happened on page
Is there any way to stay monitoring the events that are happening on the page? Any function you leave by registering on console.log for example, I don’t know, it’s just an example.. There’s a way to…
-
4
votes3
answers73
viewsWhen I click on the text it does not change (js)
I’m learning JS and I can’t understand why I don’t change H1’s text when I click on it. <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="utf-8"> <title>Testes…
-
4
votes1
answer401
viewshow to change the display of div by js?
For some reason that I do not know this time the browser does not want to render the code... basically I need to change the display: nome of div for display: blockthrough javascript. botaoSticky =…
-
4
votes2
answers81
viewsHow to make the same event work several times in different elements?
I created a formula in which when clicking on a field its bottom edge changes color, and I used an onblur() so that the color returns to normal when clicking outside. However, I wanted this function…
-
3
votes1
answer1380
viewsClick on an element that triggers the click on another
I have 5 images on my Slide <li><img src="images/slide3.jpg" alt=""></li> <li><img src="images/slide2.jpg" alt=""></li> <li><img src="images/slide5.jpg"…
-
3
votes1
answer320
viewsCapture dynamically created element index
I intend to create a seemingly very simple function. My code is this: var coordenates = $(".coordenates"); var add = $('.add'); var remove = $('.remove'); var newCoordenate = '<div…
-
3
votes1
answer196
viewsCallback from $.get is not called and I can’t debug to find out why
I am developing a mobile application (with Cordova) that needs to make a select in online BD, and with this data update the mobile BD, but I came across a problem, I perform select in the mobile BD…
javascript jquery html5 apache-cordova javascript-eventsasked 9 years, 5 months ago Vinicius VAz 521 -
3
votes3
answers43
viewshow to execute a specific button on a list of 5 identical buttons
I’m doing a user-friendly Dashboard and I need a button to edit. When the edit button runs it just makes code appear and disappear, but wanted to know if it is possible to execute jQuery code and…
-
3
votes1
answer3256
viewsFunction . click being executed twice
I have a $(".btn-buy") function. click() which, when I click, runs twice. I can’t solve the problem. I’ve already searched the whole code and it doesn’t have duplicity. Which could be? Function:…
-
3
votes2
answers5626
viewsTrigger event when user starts typing in search field
On the site there is a search field where the user enters the product and performs the search. I would like to trigger a Javascript event at the moment the user starts typing the text in the search…
-
3
votes2
answers51
viewsWhy doesn’t Event exist inside the lower block?
I’m having trouble accessing the event.target within the function setTimeout in the code below. const botao = document.querySelector('button'); botao.addEventListener('click', () => {…
-
3
votes2
answers881
views.addeventlistener is not a Function
I want to add an event when the page scrolls, but the following error occurs: Uncaught TypeError: document.getElementsByTagName(...).addEventListener is not a function Follows code:…
-
3
votes0
answers200
viewsHow to get sense of the device using gyroscope and accelerometer? Ionic 3
I’m developing an application in Ionic 3, where I need to know what direction the user’s phone is pointing to, and then make the decision. I was trying to use the plugin Device Orientation, which…
-
3
votes1
answer68
viewsKeyboard shortcut system with special characters
Hello, I’m making a system to detect javascript shortcuts, and it works great, except if for example click on SHIFT + 1 what I get SHIFT+!, and all the other changes shift makes. There is some way…
-
3
votes2
answers488
viewsKeep your focus on Inputtext
I have a form with two Inputtext, I need the focus always remain in the Input and only pass to the following via script, in case the user clicks outside the Input, the focus needs to remain in the…
-
3
votes3
answers993
viewsRemove "disabled" with Javascript
Good evening. I wanted to remove the disabled attribute from a tag when a certain condition is met, but I couldn’t find any idea how to do that. Below the HTML: Escreva aqui: <input type="text"…
-
3
votes2
answers384
viewsHow to call a function in javascript by Android keyboard enter?
Good night. I’m studying and I really need three things, but if you can help with just one, that’s good, I tried to search and applied many tips from various websites but I was not successful. I…
-
3
votes1
answer55
viewsHow to avoid duplicate Javascript addeventlistener calls?
I would like to add an event to several different classes, example: exemplo1.addEventListener('click', function(){ //Evento bla bla }); exemplo2.addEventListener('click', function(){ //Evento bla…
-
2
votes1
answer1097
viewsevent on property or use addeventlistener
One thing I’ve always wondered if it’s standard to use addEventListener or the property of the tag <body onload="">. Some say it’s the addEventListener and others say it’s for property.…
-
2
votes1
answer76
viewsWhy isn’t the code working?
I want, by means of a script (Javascript pure and simple), alert after the click in a given link (class "get out of") The following: "You are leaving the site". Man script is like this:…
-
2
votes2
answers497
viewsHow to manipulate Event Listeners order of a DOM element
I have a link: <a href="foo" class="foo">go to foo</a> First Event Handler (main.js) document.querySelector('.foo').addEventListener('click', function( event ) { console.log(1); }); In…
-
2
votes0
answers65
viewsMousedown in Chrome 55
I use the event mousedown in JS to assign an action to my object in a project in question. With the new Chrome update to version 55 my event no longer works! Does anyone have any idea how to use the…
-
2
votes1
answer1567
viewsOnload event for iframe
Question Let’s say on my website I have a iframe reserved to upload a possible external page, and this iframe be with display:none, how I could create in callback to fire at the end of loading this…
-
2
votes1
answer58
viewsES6 and addeventlistener(). Why does this method not accept reference from an anonymous function?
Why click is not invoked? $elemento.addEventListener('click', click, true); var click = () => { ... };
-
2
votes1
answer979
viewsExport CSV data via JS
I have a data set in the database in my back end, and I need to create a button on which the user will click to export this data in CSV format. But I have never done this type of event in J. Someone…
-
2
votes1
answer282
viewsEvent with and without addeventlistener are not equal?
Because this doesn’t work: window.addEventListener('beforeunload', function(){ return 'wait a minute' }) And this works: window.onbeforeunload = function(){ return 'wait a minute' } They’re not the…
-
2
votes1
answer43
viewsProblem with Eventlistener execution
if((document.getElementById("avatarZica").innerHTML == "")){ document.getElementById("avatarLegal").addEventListener("click", function(){ document.getElementById("avatarZica").innerHTML =…
-
2
votes1
answer645
viewsI have one form inside the other and I can’t get the most internal form
Here’s an example of how the form is, it’s much more complex than that, it’s almost 10 years old and I don’t have time to modify everything. But I need to have access to the form inside the other,…
-
2
votes1
answer72
viewsDoubt in a Javascript onclick event
I have this javascript code to add and remove the added lines. function adicionar() { var itm = document.getElementById("itens").getElementsByClassName("div-bloco-form")[0]; var cln =…
-
2
votes1
answer217
viewssetCustomValidity does not work with Ajax
In a field change event I try to validate a username through an Ajax call. Apparently the setCustomValidity of Html5 does not work with jQuery. I ask for help for anyone who knows javascript.…
javascript-eventsasked 7 years, 5 months ago lorenzzo 36 -
2
votes0
answers421
viewsInsert onclick event into dynamically created input
I have a table where the user can insert a row into the table and then delete it if necessary. For this, when it adds a Row, in the second cell I insert two cells. One contains the content and the…
-
2
votes2
answers4025
viewsJquery UI autocomplete JS input
Hello I have a problem here when I create an input dynamically and it should work the Widgets autocomplete jquery ui. I saw several forums and they show how to make it work, but my problem is that…
-
2
votes1
answer680
viewsMask input when loading page
I have a page that displays some user information. One of the fields is the phone field. I want to apply a mask to this field when loading the page. I can even put the mask, but only in the onKeyUp…
-
2
votes2
answers65
viewsEvents in Javascript
I’m studying you and I came across the following: const h1 = document.querySelector('h1'); //1 h1.addEventListener('click', () => { alert('Funcionou!'); }); //2 h1.onclick = () => {…
-
2
votes2
answers63
viewsToggle the text of an element with each click
I’m willing to keep changing what’s written in the DOM as a loop. But when he goes to the end of the teste1 and calls the teste, should not start the function again teste?…
-
2
votes1
answer107
viewssetTimeout and clearTimeout giving error
I’m having problems with this Script, initially the purpose of it is just to show the controls while the mouse moves or clicks on the div, and when it stops moving it hides the controls after a…
-
2
votes1
answer26
viewsHow to run PHP JAVASCRIPT code without an event
Next, I’m trying to replace the alert for modal of that lib that uses jquery. In this case I am using the first example: <div id="ex1" class="modal"> <p>Usuário ou senha…
-
2
votes1
answer145
viewsGenerate a new JSON by manipulating data from another JSON
I was participating in an internship test and I was proposed the following problem: I would have to read the JSON below: [ { "nome":"Jabba, the Hutt", "jedi":false, "sistemas":[ "Tatooine" ] }, {…
-
2
votes3
answers4332
viewsPassing HTML Parameters to Javascript
Good afternoon Galera! I need to pass parameters from a small HTML form to a Javascript function but I’ve tried it in every way and it doesn’t work! Where am I going wrong? function pessoa(nome) {…
-
2
votes1
answer103
viewsProblem with post/get method to update table
I’m trying to update my table using javascript so I don’t have to leave the screen every time I turn off a field, my table: The button I used in PHP but went to another page: <td…
-
2
votes1
answer144
viewsHow to reverse Rotate with javascript?
I’m trying to make an animation with pure javascript, and I’m using style.transform = "rotate(" + ang + "deg)"; to do this. My intention is: when it reaches an x position, it goes back…