jquery - jQuery占位符文本一旦更改就不能再更改
问题描述
我想更改占位符的文本。我有些如何用 jQuery 改变它。运行代码后,我的新占位符是“输入收件人的电子邮件”但现在我想将占位符文本更改为“收件人的电子邮件”。我已经更新了代码。但占位符显示旧文本“输入收件人的电子邮件”。我不知道为什么。
jQuery(document).ready(function($) {
$('#pwgc-to').attr("placeholder", "enter receiver’s email").val("").focus().blur();
})
以下代码已添加到 function.php
add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
wp_enqueue_script(
'change-placeholder', // name your script so that you can attach other scripts and de-register, etc.
get_stylesheet_directory_uri() . '/js/change-placeholder.js', // this is the location of your script file
array('jquery') // this array lists the scripts upon which your script depends
);
}
解决方案
推荐阅读
- excel - 在另一个工作簿中调用函数导致崩溃或自动化错误
- mysql - Why performance difference in MySQL for where vs join clause
- iis - IIS giving 503 error while using ApplicationPoolIdentity
- sql - 从子表中选择不在另一个表中且父级没有其他子级的记录
- visual-studio-code - How to get currently opened file's project folder path in visual studio code extension.js
- excel - Excel to Powerpoint Chart
- json - jq解析多个值
- python-3.x - Get full content of div when performing urllib GET request
- java - What to use spring Restcontroller or RepositoryRestResource
- lambda-calculus - Lambda 演算函数归约步骤