2013-03-02 73 views
-2

我看了重複。我已經推吞下這個腳本只是我的結束標記之前,但我收到以下錯誤,新的未捕獲的語法錯誤:意外的令牌非法

Uncaught Syntax error: Unexpected token ILLEGAL

<script type="text/javascript"> 
    $(document).ready(function() { // here is the error 
    $(#search).keypress(function(e) { 
     if(e.which == 13) { 
      myFunction(); 
     } 
    }); 
    $("#status").hide(); 
    alert("hide on load "); 
    $("#more").hide(); 
    }); 
    </script> 

回答

0
$(#search).keypress(function(e) { 

應該是

$("#search").keypress(function(e) { 
0

這是因爲你缺少引號圍繞你的jQuery選擇器...

$("#search").keypress(function(e) { 
    //... 
} 
0

它看起來像$(#search).

問題與引號替換$('#search').

相關問題