link to codepen https://codepen.io/robert-carvalho/pen/dBLQNb
I got inspired by the pig latin challenge to try to evolve it into something useful. So I chose to do a simple
web page that converts your english to pig latin.
The problem I am running into is it only displays the result for a fraction of a second then goes blank again. Any suggestions on what is wrong?
Hi komegga
I think your javascript is correct , the reason behind the problem is that whene you click on the button your form will be submited causing a page refreshe
A simple solution is adding type="button"
to your button
Note : there are other solutions , like , event.preventDefault()
on eventlistiners to stop page refreshe
1 Like
Thank you so much. So simple.
1 Like
Thanks @camperextraordinaire for that information. I will try to implement it. Would you recommend @AbdelliNasredine answer for something like I have?
@camperextraordinaire Oh I misread that, now I see. Thank you. I changed it to your way and it works perfectly.