开发者

What is the default behavior of the ENTER key press event?

I have an Email Id text box. My requirement is that an user enters some valid Email ID into the Text box and Press Enter key. A status message or an e开发者_StackOverflow社区rror message should be displayed. I have a button called Send after the Text box. On Click Send button or On ENTER key press(The focus should be on text box not on the Send button) it is going to make an Ajax call.

I have On Success and On Fail methods in that Ajax call. On Success I am going to display a status message saying "Successfully sent message". On Fail I am displaying some other error.

The problem is that I am not able to see any status or error message on my page. Instead the page is getting refreshed. Is it because of the default behavior of the ENTER key press Event ?


Yes, it is because of the default behaviour. You can return false in your JScript to avoid a post back from happening.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜