Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32259

Having to click TWICE for event

Newsgroups comp.lang.javascript
Date 2017-01-22 22:55 -0800
Message-ID <508acb43-edf6-446c-9f3e-ec2ebd7979cb@googlegroups.com> (permalink)
Subject Having to click TWICE for event
From bit-naughty@hotmail.com

Show all headers | View raw


..I have a link on my webpage, upon clicking of which, I want some stuff to happen (without a refresh, ie. on THAT page). This is my code:

<div id="myid" align="center">
			<a href='javascript:document.getElementById("myid").addEventListener("click", function(event) {
	event.preventDefault();
alert("clicked");
	}


Now when I click, nothing happens! Then if I click AGAIN, the "clicked" box pops up! - I want it to popup on the FIRST click, obviously. What's going wrong?



Thanks.

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-22 22:55 -0800
  Re: Having to click TWICE for event Maik Koenig <usenetspam@maikkoenig.de> - 2017-01-23 09:08 +0100
    Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-23 10:47 -0800
      Re: Having to click TWICE for event Maik Koenig <usenetspam@maikkoenig.de> - 2017-01-23 22:45 +0100
        Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-24 06:00 -0800
          Re: Having to click TWICE for event Ram Tobolski <ramtob@gmail.com> - 2017-01-24 10:27 -0800
            Re: Having to click TWICE for event jonas.thornvall@gmail.com - 2017-01-24 10:55 -0800
            Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-24 11:05 -0800
              Re: Having to click TWICE for event Ram Tobolski <ramtob@gmail.com> - 2017-01-24 13:10 -0800
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-24 22:56 -0800
                Re: Having to click TWICE for event Maik Koenig <usenetspam@maikkoenig.de> - 2017-01-25 11:55 +0100
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-25 07:03 -0800
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-26 23:59 -0800
                Re: Having to click TWICE for event Ram Tobolski <ramtob@gmail.com> - 2017-01-25 11:05 -0800
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-24 23:25 -0800
                Re: Having to click TWICE for event Maik Koenig <usenetspam@maikkoenig.de> - 2017-01-25 11:57 +0100
                Re: Having to click TWICE for event Ram Tobolski <ramtob@gmail.com> - 2017-01-25 11:14 -0800
            Re: Having to click TWICE for event Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-01-24 21:41 +0100
              Re: Having to click TWICE for event Ram Tobolski <ramtob@gmail.com> - 2017-01-24 13:13 -0800
              Re: Having to click TWICE for event "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-24 23:46 +0100
                Re: Having to click TWICE for event Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-01-25 00:20 +0100
                Re: Having to click TWICE for event "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-25 11:19 +0100
              Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-24 23:00 -0800
                Re: Having to click TWICE for event Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-01-25 09:32 +0100
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-25 07:05 -0800
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-26 23:58 -0800
                Re: Having to click TWICE for event Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-01-27 12:48 +0100
                Re: Having to click TWICE for event Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-27 13:13 +0100
              Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-24 23:03 -0800
                Re: Having to click TWICE for event "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-25 11:21 +0100
                Re: Having to click TWICE for event bit-naughty@hotmail.com - 2017-01-25 07:10 -0800
                Re: Having to click TWICE for event "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-25 17:42 +0100

csiph-web