【问题标题】:JQuery issue with IE8: Expected identifierIE8 的 JQuery 问题:预期的标识符
【发布时间】:2012-06-15 04:11:58
【问题描述】:

我尝试了一些我在这里搜索找到的修复程序,但它们似乎不起作用......

我得到一个预期的标识符、字符串或数字 char 36,所以是左括号。我尝试用双引号替换所有单引号没有变化......

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

似乎在任何地方都可以正常工作,但 IE...

【问题讨论】:

    标签: jquery internet-explorer cross-browser


    【解决方案1】:

    classseems to be reserved in IE。尝试用引号括起来:

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

    【讨论】:

      【解决方案2】:

      这没有错。

      问题是由于文件中其他内容的组合而发生的。发布整个文件。这在 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>
      

      【讨论】:

        【解决方案3】:

        试试这个

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2012-08-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-19
          相关资源
          最近更新 更多