我有兩個input
字段。一種是隱藏式的(我現在已經把它做成了一種文本類型)並且動態地獲取它的值。取決於此值,我將顯示具有該值的alert
,並在其他input
字段後顯示一些特定信息。當輸入字段值發生變化時啓動一個函數 - jQuery
假設input
字段首先有一個table_rate:38的值(值也可以是空的)。現在問題開始了。當input
字段的值更改爲table_rate:23時,應該出現alert
,並且應該在其他input
字段之後顯示信息。但它不起作用。
在這裏您可以將HTML:
<p class="form-row form-row form-row-wide address-field validate-required validate-postcode form-row-first woocommerce-validated" id="billing_postcode_field" data-o_class="form-row form-row form-row-wide address-field validate-required validate-postcode">
<label for="billing_postcode" class="">
Postnummer
<abbr class="required" title="påkrevet">*</abbr>
</label>
<input type="text" class="input-text " name="billing_postcode" id="billing_postcode" placeholder="Postnummer" value="" autocomplete="off">
</p>
<input type="text" name="shipping_method[0]" data-index="0" id="shipping_method_0" value="table_rate:38" class="shipping_method">
Here你可以看到完整的jsfiddle。
我該如何解決這個問題?
感謝您的幫助!
問題是在if語句中,嘗試像這樣:if(zone =='table_rate:33')帶雙等號並且它將起作用 – rosuandreimihai
感謝您的評論,但這並不奏效,恐怕。 –