gpt4 book ai didi

javascript - 编辑注册表单 woocommerce 中的字段类型

转载 作者:行者123 更新时间:2023-11-28 05:54:47 25 4
gpt4 key购买 nike


我使用以下代码to add custom fields in user registration on the "My Account" page使用 woocommerce,它工作成功,但现在我想更改显示为 select 的一个字段的类型,以仅显示 3 个状态:
- 巴黎,
- 伦敦< br/>- 阿尔及尔
那么我该如何编辑这段代码:

<p class="form-row form-row-last">
<label for="reg_billing_state"><?php _e( 'State', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_state" id="reg_billing_state" value="<?php if ( ! empty( $_POST['billing_state'] ) ) esc_attr_e( $_POST['billing_state'] ); ?>" />

</p>

我已经尝试过了,但是没用!

<p class="form-row form-row-last">
<label for="reg_billing_state"><?php _e( 'Commune', 'woocommerce' ); ?> <span class="required">*</span></label>
<input list="states" class="input-text" name="billing_state" id="reg_billing_state" value="<?php if ( ! empty( $_POST['billing_state'] ) ) esc_attr_e( $_POST['billing_state'] ); ?>" />
<datalist id="states">
<option value="Paris">
<option value="London">
<option value="Algiers">
</datalist>
</p>

提前谢谢您!

最佳答案

已解决
我目前找到的解决方案如下:

<p class="form-row form-row-last">
<label for="reg_billing_state"><?php _e( 'Commune', 'woocommerce' ); ?> <span class="required">*</span></label>
<select id="reg_billing_state" class="input-text" name="billing_state">
<option value="Alger">Alger</option>
<option value="Zeralda">Zeralda</option>
<option value="Beni Messous">Beni Messous</option>
</select>
</p>

关于javascript - 编辑注册表单 woocommerce 中的字段类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37791707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com