cpd Posted July 22, 2009 Share Posted July 22, 2009 The subject says it all really. Its probably really simple but i dont know how to do it. Ive made an Ajax Chat and id like the user to be able to hit the enter button rathern then pressing Submit and im not sure how to do it without making the page refresh? Quote Link to comment Share on other sites More sharing options...
php-shawn Posted July 24, 2009 Share Posted July 24, 2009 <form action="javascript:void(0)" onSubmit="YOURFUNCTION()"> Quote Link to comment Share on other sites More sharing options...
xtopolis Posted July 24, 2009 Share Posted July 24, 2009 You don't have to use a form at all if you're going to do it this way. On your textfield, make a function that detects the enter key (you can google "javascript detect enter key". Then use whatever function you want to send the data via ajax... no form required. Quote Link to comment Share on other sites More sharing options...
cpd Posted July 25, 2009 Author Share Posted July 25, 2009 yeah sorry i forgot to say that im not actually using a form, whoops. I think its sorted now anyway. Danke Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.