占位符在IE8中不起作用&;IE9,甚至使用jQuery插件
我使用以下插件来显示IE8和IE9中的占位符。我认为它在去年起了作用,但现在不是: 实际上,这个插件在演示页面上工作得非常好: 我真的不知道怎么修。我在WordPress中使用它,在这里我加载本地jQuery,如果我记得清楚的话,它通常是最后一个版本。我将脚本放入functions.php的队列中:占位符在IE8中不起作用&;IE9,甚至使用jQuery插件,jquery,wordpress,placeholder,Jquery,Wordpress,Placeholder,我使用以下插件来显示IE8和IE9中的占位符。我认为它在去年起了作用,但现在不是: 实际上,这个插件在演示页面上工作得非常好: 我真的不知道怎么修。我在WordPress中使用它,在这里我加载本地jQuery,如果我记得清楚的话,它通常是最后一个版本。我将脚本放入functions.php的队列中: function szt_load_scripts() { wp_enqueue_style( 'style', get_stylesheet_uri() ); wp_enqueue_style
function szt_load_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'shortcodes', get_stylesheet_directory_uri() . '/shortcodes.css' );
wp_enqueue_script('jquery');
if ( is_singular() ) {
wp_enqueue_script( 'comment-reply' );
}
if (ot_get_option('szt_enable_linkbuilding') === "on") {
wp_deregister_script( 'link-building-pro-min' );
wp_register_script( 'link-building-pro-min', get_template_directory_uri().'/jquery/link-building-pro/link-building-pro-min.js', array(), true, true);
wp_enqueue_script( 'link-building-pro-min' );
}
wp_enqueue_script('scripts', get_stylesheet_directory_uri() . '/jquery/scripts.js');
wp_localize_script('scripts', 'contactForm', array(
'youForgot' => __('<span class="errormsg">You forgot to enter your ', 'wptheme'),
'invalidEmail' => __('<span class="errormsg">You entered an invalid email.</span>', 'wptheme'),
'messageSent' => __('<p class="thanks"><strong>Thanks!</strong> Your message was successfully sent.</p>', 'wptheme')
));
}
add_action('wp_enqueue_scripts', 'szt_load_scripts');
函数szt_加载_脚本(){
wp_enqueue_style('style',get_stylesheet_uri());
wp_enqueue_style('shortcodes',get_stylesheet_directory_uri()./shortcodes.css');
wp_排队_脚本('jquery');
如果(是单数()){
wp_排队_脚本(“评论回复”);
}
if(ot_get_选项('szt_enable_linkbuilding')==“on”){
wp_注销_脚本(“链接构建专业分钟”);
wp_register_脚本('link building pro-min',get_template_directory_uri()。/jquery/link building pro/link-building-pro-min.js',array(),true,true);
wp_enqueue_脚本('link building pro min');
}
wp_enqueue_script('scripts',get_stylesheet_directory_uri()。/jquery/scripts.js');
wp_本地化_脚本('scripts','contactForm',数组(
“You遗忘”=>\uuuuuu(“您忘了输入您的”“wptheme”),
“invalidEmail”=>\uuuuu(“您输入的电子邮件无效。”,“wptheme”),
“messageSent”=>(谢谢!您的邮件已成功发送。,“wptheme”)
));
}
添加动作(“wp_排队_脚本”、“szt_加载_脚本”);
我是否以错误的方式加载插件?
我是否需要使用较旧版本的jQuery?
我是否需要为此添加其他修复程序?您必须初始化(document).ready()中的插件。您在错误控制台中看到了什么(如果有的话)?您是否可以转到页面并查看源代码以确保脚本被添加到页面中?另外,仅仅添加脚本是不够的,您还需要运行
$('input,textarea').placeholder()
在文档中。就绪
。我不知道如何使用错误控制台@tisont@Gerard按F12键。@tisont。它有一个错误:“UncaughtTypeError:无法读取未定义的measureIt.js:120(匿名函数)的属性'create'。”。但是它属于measureIt.js文件,它不属于主题。Ahm,我所做的是插入$('input,textarea').placeholder()代码>在插件之后。我想这是错的。应该是$(document).ready(函数(){$('input,textarea')。占位符();})代码>。我要测试一下,还是不行。也许我遗漏了什么。无论如何,我认为你的回答是对的。我认为这是公认的答案。谢谢无论如何,您的控制台上有一些错误。你把它修好会有帮助的。我怎么做?我很擅长复制和粘贴代码,但我真的不知道如何调试JavaScript。Hi@Genethic,我在单击搜索按钮时发现了一个错误(它显示一个弹出窗口):positionPopup()代码>。你发现了更多的错误吗?正如我所见,控制台只在需要执行代码时(在Google Chrome和Firefox上)才会调试代码。因此,我推断解决方案是逐个测试所有函数。是这样吗?