shan
shan

Reputation: 3145

Input buttons not working in Firefox, working in Chrome?

I have an input button like so:

<input value="submit" type="text" onclick="doThing"/> 

Is there any reason why this shouldn't be working in Firefox? I know Firefox functions work differently than in Chrome sometimes, but I'm not sure when this is the case.. I get no console errors in Firefox, annoyingly. The doThing function is not getting fired at all.

Any documentation about why this functions differently in Firefox? Or is this a more obscure bug? Any help would be appreciated, thanks!

Upvotes: 0

Views: 564

Answers (1)

shan
shan

Reputation: 3145

Found the solution! Bit of a Firefox quirk. The issue was not with the event listener, it was that somewhere else in my code I had to set the disabled value of my input to true in order to prevent multiple button clicks while my database was updating. In Chrome, when you refresh the page, the value of disabled is reset back to false, but in Firefox there is a feature where it remembers the values of input fields.

Setting autocomplete="off" to my <input/> DOM element did the trick. It now works as intended in both Firefox and Chrome.

Upvotes: 3

Related Questions