Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Page refresh on click compulsory? Date: Fri, 22 Jul 2016 16:28:58 +0100 Organization: A noiseless patient Spider Lines: 19 Message-ID: <87twfhadz9.fsf@bsb.me.uk> References: <6b57de12-0b7b-4d3c-b674-47909c16c2ce@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="13214"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tGUfm2e0rDaP3asJ5fYK6gbD5wRE3WsY=" Cancel-Lock: sha1:z58UhiNwTXT/BOvyvhvkwS2wvU0= sha1:k1pxf932OQd/Vg6IFGfpxr4xHn0= X-BSB-Auth: 1.840107d1b684cfca0c31.20160722162858BST.87twfhadz9.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:30960 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(). -- Ben.