如何强制将WooCommerce账户页面中的邮编字段输入大写,这样如果有人输入rh12 3uc就会变成RH12 3UC?
add_action('wp_footer', 'postcode_toupper');
function postcode_toupper(){
echo '<script>jQuery(function($) {$("#billing_postcode").keyup(function() { this.value = $("#billing_postcode").val().toUpperCase(); });});</script>';
}
在你的活动主题函数.php中添加以下代码
我倾向于使用CSS text-transform: uppercase。
对于元素id 'billing_postcode' 使用...
#billing_postcode {text-transform: uppercase;}