私は2つのinput
フィールドを持っています。 1つは隠しタイプです(私は今のところテキストタイプにしています)、それを動的に値にします。この値に依存して、私はその値でalert
を表示し、他のinput
フィールドの後にいくつかの特定の情報を表示します。入力フィールド値が変更されたときに関数を開始する - JQuery
たとえば、input
フィールドの値がtable_rate:38(値は空の場合もあります)とします。そして今、問題が始まります。 input
フィールドの値がtable_rate:23に変更されると、alert
が表示され、もう1つのinput
フィールドの後に情報が表示されます。しかし、それは動作しません。
<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を見ることができます:ここで
はあなたのHTMLできます。
どうすればこの問題を解決できますか?
ありがとうございました!
問題はif文にあり、次のようにしてみてください:if(zone == 'table_rate:33')二重等号で動作します – rosuandreimihai
あなたのコメントをありがとうが、これはうまくいきません。 –