enter in textBox
Im trying to create functionality in which after user enters "ENTER开发者_开发百科" button the button is clicked.
What I came to is :
$(selector).keyup(function(e) {
if (e.keyCode == 13) {
eval($("#" + buttonID).attr('href'));
}
});
it works perfectly but there is one example in which i would like it to behave in different way:
When I start typing letters in my textBox there are hints displayed below (stanard chrome behaviour) so that I can choose one of the previous values typed to the textBox. I choose it and hit enter. At this point I dont want to submit form but it does according to my js code. Is there any way to get rid of such behaviour ?
thanks for help
Problem resolved by using keypress event.
精彩评论