event.preventDefault doesn't seem to work
So im trying to stop a form from refreshing the page and this is the code i'm using: $("#getName").submit(function(refresh) { refresh.preventDefault(); $("#p22").fadeOut(50); $("#p23").fadeIn(800); document.getElementById("p23").innerHTML = "Oh " + userName + ", alright i wont forget that!"; }) I can't seem to get this working properly.... id = getName - is the form id Michail Michailidis Your question is similar to: https://stackoverflow.com/a/6462306/986160 Try this: $("#getName").submit(function(refresh) { $("#p22").fadeOut(50); $("#p23").fadeIn(800); $("#p23").html("Oh " + userName + ",