【问题标题】:call back jquery function in IE, 8, 7 browsersIE、8、7浏览器回调jquery函数
【发布时间】:2013-06-15 15:26:02
【问题描述】:

我有 jquery 插件,它适用于所有浏览器,包括 IE 10 和 IE 9。

我有 HTML 表单,其中一个下拉值是动态生成的,值来自 jQuery。我只是在我的 HTML document.ready 函数中简单地调用了这个函数,所以简化了我在查询插件中创建了一个简单的函数“pressMe()”,它正在调用警报函数但仍然没有发生..

$.fn.pressMe = function () {

  alert("aaaaaaaaaaaaaaaaaaaaaaa");
}

html表单页面:

<!DOCTYPE html>
<html>
  <head>
     <script src="../scripts/jquery-1.9.1.min.js"></script>

    <script>

       $(document).ready(function () {

           $(this).pressMe();
       }
    </script>
  </head>
<body>
               // rest of code//

【问题讨论】:

  • 控制台有错误吗? (F12)
  • SCRIPT1028:预期标识符、字符串或数字 searchProperty_Plugin.js,第 744 行字符 33 SCRIPT438:对象不支持属性或方法 'pressMe' searchForm.html,第 29 行字符 16
  • 好了。检查searchProperty_Plugin.js文件的第744行
  • 问题肯定出在其他地方;这个简单的工作jsfiddle.net/IrvinDominin/Fazuy,但你错过了 document.ready 函数末尾的 )。
  • 不,我知道)在那里...只是在这里打字时错过了...!!!

标签: javascript jquery internet-explorer jquery-plugins


【解决方案1】:

我发现了问题,我在 jquery 对话框中传递了 jquery 类“ok_button”,由于某种原因它在 IE 8 和 IE 7 中产生了问题....

 $("#MessageBox").dialog({ title: messageTitle, buttons: [{ text: 'Ok', class:  'OkButton', click: function () { $(this).dialog('close'); } }] })

解决方案:

function displayMessage(message, messageTitle) {


$("#MessageBox").text(message);

$("#MessageBox").dialog({

    title: messageTitle,
    buttons: [{ text: 'Ok', click: function () { $(this).dialog('close'); } }]
});
}

【讨论】:

  • jQuery 已放弃对 IE 7 和 8 的支持,因此您需要考虑这一点。
猜你喜欢
  • 2012-01-17
  • 2011-01-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-26
  • 2011-11-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多