Clojurians
#reagent
<
2016-07-25
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

hjrnunes16:07:50

Hi everyone? Any idea why/how would a button cause a browser reload? I have a simple button with an on-click function and for some strange reason it’s causing the page to reload when I click it. It does execute the function because I see the print in the console for a fleeting moment before the reload kicks in…

hjrnunes16:07:51

It’s driving me nuts.

mihaelkonjevic16:07:05

is your button inside the form? it could be submitting the form if you’re not calling preventDefault on the event

hjrnunes16:07:16

yeah, just realised it is

hjrnunes16:07:26

it’s inside a reagent-forms template

hjrnunes16:07:00

that’s odd, never had to do that before

hjrnunes16:07:11

…because I wasn’t using the form element and now I am. Duh!

hjrnunes16:07:22

@mihaelkonjevic: thanks man!

eyelidlessness18:07:23

@hjrnunes: you can also set the button’s :type to ”button”, then clicking it will not submit the form at all