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


Groups > comp.lang.javascript > #30960

Re: Page refresh on click compulsory?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Page refresh on click compulsory?
Date 2016-07-22 16:28 +0100
Organization A noiseless patient Spider
Message-ID <87twfhadz9.fsf@bsb.me.uk> (permalink)
References <6b57de12-0b7b-4d3c-b674-47909c16c2ce@googlegroups.com>

Show all headers | View raw


bit-naughty@hotmail.com writes:

> If I click on something, does it ALWAYS mean that the page will blank,
> and the next page will be got? How is this prevented exactly? If I
> just do a "addEventListener" with a "click" argument, will it be
> prevented?

If you install the event handler using addEventListener, you have to
cancel the event's default behaviour by calling

  event.preventDefault()

in the handler function.  There's also the possibility that you don't
want the event to propagate further up (or down) which you would do with
event.stopPropagation().

<snip>
-- 
Ben.

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


Thread

Page refresh on click compulsory? bit-naughty@hotmail.com - 2016-07-22 06:51 -0700
  Re: Page refresh on click compulsory? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-07-22 16:42 +0200
  Re: Page refresh on click compulsory? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-22 16:28 +0100

csiph-web