I want to click enter instead of submit button and I want jquery to do the exact same task as if I were clicking the submit button.
This is what I have but its not working
the jquery
$("#search-friend-text").keypress(function(e){ // start enter click
switch(e){
case 13:
$.post("<?php echo site_url('userProfile/search_friend'); ?>",
$("#add-friend-search").serialize(),
function(data){
$("#insert-activity").html(data);
});
$("#add-friend-search").slideUp("slow",function(){});
break;
}
}); // end enter click
the Html (form)
<form method="post" action="" name="searchFriendForm" id="add-friend-search">
<input type="text" id="search-friend-text" name="searchFriendText">
<input type="button" class="small green button" id="add-friend-button" />
</form>