Why page is reloaded when press enter in textbox?

Chrome, Opera and safari require event handler return false to stop
event propagation, or else, press enter cause browser reload the page.

$("#QueryPanel input").keypress(function(e){
                    
if (e.which == 13) {
                        dataCache.remove(
0,dataCache.length-1);
                        doQuery(
null,true);
                        e.stopPropagation();
                        
                        
return false;
                    }
            });


posted @ 2008-10-30 09:56  octoberfirst  阅读(229)  评论(0编辑  收藏  举报