Javascript 输入时强制将邮政编码字段转换为大写
我如何强制将WooCommerce账户页面中的邮政编码字段输入大写,这样如果有人输入rh12 3uc,就会将其输入rh12 3uc?Javascript 输入时强制将邮政编码字段转换为大写,javascript,wordpress,woocommerce,hook-woocommerce,postal-code,Javascript,Wordpress,Woocommerce,Hook Woocommerce,Postal Code,我如何强制将WooCommerce账户页面中的邮政编码字段输入大写,这样如果有人输入rh12 3uc,就会将其输入rh12 3uc?add_action('wp_footer','postcode_toupper'); add_action('wp_footer', 'postcode_toupper'); function postcode_toupper(){ echo '<script>jQuery(function($) {$("#billing_postcode"
add_action('wp_footer','postcode_toupper');
add_action('wp_footer', 'postcode_toupper');
function postcode_toupper(){
echo '<script>jQuery(function($) {$("#billing_postcode").keyup(function() { this.value = $("#billing_postcode").val().toUpperCase(); });});</script>';
}
功能邮政编码_toupper(){
echo'jQuery(function($){$(“#billing_postcode”).keyup(function(){this.value=$(“#billing_postcode”).val().toUpperCase();});
}
在活动主题函数中添加此代码。php我倾向于使用CSS文本转换:大写 对于元素id“账单\邮政编码”,请使用
#billing_postcode {text-transform: uppercase;}