2012-06-14 47 views
1

我嘗試了幾個補丁我發現這裏四處尋找,但他們似乎並沒有工作,所以......JQuery的問題與IE8:預期標識符

我得到一個期望的標識符,字符串或數字字符36所以左括號。我試着replaicing所有的單引號用雙引號沒有改變...

if (($('#attachment_asset').length) && ($('p.please-wait').length == 0)) { 
    $('.buttons').append($('<p/>', { 
     class: 'please-wait', 
     text: 'Please wait, uploading your file...' 
    })); 
} 

看起來工作得很好,但無處不在IE瀏覽器...

回答

4

classseems to be reserved in IE。嘗試用引號包圍它:

$('.buttons').append($('<p/>', { 
    "class": 'please-wait', 
    text: 'Please wait, uploading your file...' 
})); 
+0

優秀!謝謝。 –

0

沒有什麼不對。

問題發生在文件中的其他東西的組合。發佈整個文件。這在ie9中正常工作。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
    <title> New Document </title> 
    <meta name="Generator" content="EditPlus"> 
    <meta name="Author" content=""> 
    <meta name="Keywords" content=""> 
    <meta name="Description" content=""> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> 

    <script language="javascript"> 
if (($('#attachment_asset').length) && ($('p.please-wait').length == 0)) { 
    $('.buttons').append($('<p/>', {class: 'please-wait', text: 'Please wait, uploading your file...'})); 
} 
    </script> 
</head> 

<body> 

</body> 
</html> 
0

試試這個

$('.buttons').append($("<p>").addClass("please-wait").append("Please wait, uploading your file..."));