Jquery 函数(类)在IE中不工作
我无法让这个插件在IE中正常运行 看看我的主页,看看顶部巨大的搜索区域 www.naturalskin.com 每当我刷新屏幕时,模糊就会失去它的功能,我就会被文本卡住 以下是我在外部js页面中放置的脚本: Erik尝试绑定'blur',函数{}而不是.blurfunction{} olso使用触发“模糊”功能,避免模糊 编辑 如果您在任何时候都在使用ajax,那么使用.live而不是.bind也是一个很好的提示;Jquery 函数(类)在IE中不工作,jquery,internet-explorer,Jquery,Internet Explorer,我无法让这个插件在IE中正常运行 看看我的主页,看看顶部巨大的搜索区域 www.naturalskin.com 每当我刷新屏幕时,模糊就会失去它的功能,我就会被文本卡住 以下是我在外部js页面中放置的脚本: Erik尝试绑定'blur',函数{}而不是.blurfunction{} olso使用触发“模糊”功能,避免模糊 编辑 如果您在任何时候都在使用ajax,那么使用.live而不是.bind也是一个很好的提示; 因为这将查找新条目 什么版本的IE给你带来了麻烦?脚本中的这些更改放在哪里? j
因为这将查找新条目 什么版本的IE给你带来了麻烦?脚本中的这些更改放在哪里?
jQuery.fn.hint = function (blurClass) {
if (!blurClass) {
blurClass = 'blur';
}
return this.each(function () {
// get jQuery version of 'this'
var $input = jQuery(this),
// capture the rest of the variable to allow for reuse
title = $input.attr('title'),
$form = jQuery(this.form),
$win = jQuery(window);
function remove() {
if ($input.val() === title && $input.hasClass(blurClass)) {
$input.val('').removeClass(blurClass);
}
}
// only apply logic if the element has the attribute
if (title) {
// on blur, set value to title attr if text is blank
$input.blur(function () {
if (this.value === '') {
$input.val(title).addClass(blurClass);
}
}).focus(remove).blur(); // now change all inputs to title
// clear the pre-defined text when form is submitted
$form.submit(remove);
$win.unload(remove); // handles Firefox's autocomplete
}
});
};
$input.bind('blur',function () {
if (this.value === '') {
$input.val(title).addClass(blurClass);
}
}).focus(remove).trigger('blur');