Learning Javascript through an edit i have so im very new to all this still, i was hoping a kind soul could help me out im not completely sure why i cant get a button working on this, as for now it works with Enter Key as you can see, but i also need a button to work with it.
$("#profile").keydown(function(ev) {
if(ev.keyCode == 13) {
if(!$("#profile").val().match(/^[a-zA-Z0-9-_]+$/)) {
alert("Invalid name. Names may contain alphanumeric characters, underscores, and hyphens");
return;
}
document.location = "r/" + $("#profile").val();
}
});