2011-10-20 107 views
0

我嘗試構建自己的選擇器,但出現錯誤。構建選擇器

螢火告訴我:

丟失)後的參數列表

$("#for_" + $(this)attr('id') + "").click(function() { 

    alert($(this).attr("id")); 

}); 

能有人幫助我plaese?

+0

'$(this)attr('id')'是一個語法錯誤。您可能需要'$(this).attr('id')'(或簡單地說'this.id')。 –

回答

0
$("#for_" + $(this)attr('id') + "").click(function() { 
        ^--- 

你錯過了.。在指定的地點。應該

$("#for_" + $(this).attr('id') + "").click(function() { 
+0

哦,我...我必須去睡覺!謝謝!! – fteinz

0
$("#for_" + $(this).attr('id')).click(function() { 
    alert($(this).attr("id")); 
}); 

Didnt你忘了 「」 attr之前?