我有一個腳本,但我不能讓它工作正常,我想顯示基於選項的輸入,例如如果我選擇「Havale」選項不同的輸入必須顯示,如果我選擇「貝寶」選項不同的輸入。根據選擇選項顯示輸入選項
我的代碼在這裏;
<script type="text/javascript">
$(document).ready(function(){
$("input[name$='group_name']").click(function(){
var option_value = $(this).val();
if(option_value=='paypal') {
$(".box1").css("display","block");
$(".box2").css("display","none");
}
else if(option_value=='havale') {
$(".box2").css("display","block");
$(".box1").css("display","none");
}
});
$(".box1").show();
$(".box2").hide();
});
</script>
and this;
<select name="payment_method" class="select2" onchange="this.form.submit();" style="width: 160px;">
<option value="">-- Ödeme şekli seçin --</option>
<option value="paypal">Paypal</option>
<option value="havale">Havale/EFT</option>
</select>
和這個;
<div class="withdraw-center">
<div class="form-input-title box1">Banka Hesap Adı Soyadı</div>
<div class="form-input-area-bg3 box1">
<input type="text" id="payment_name" class="input3" name="payment_name" value="<?php echo $row['payment_name']; ?>" size="37" />
</div>
<div class="form-input-title">Banka Adı</div>
<div class="form-input-area-bg3">
<input type="text" id="payment_bank" class="input3" name="payment_bank" value="<?php echo $row['payment_bank']; ?>" size="37" />
</div>
<div class="form-input-title">IBAN</div>
<div class="form-input-area-bg3">
<input type="text" id="iban" class="input3" name="iban" value="<?php echo $row['iban']; ?>" size="37" maxlength="26" />
</div>
<div class="form-input-title">T.C. Kimlik No</div>
<div class="form-input-area-bg3">
<input type="text" id="tckn" class="input3" name="tckn" value="<?php echo $row['tckn']; ?>" size="37" maxlength="11" />
</div>
<div class="form-input-title box2">PayPal E-mail Adresi</div>
<div class="form-input-area-bg3 box2">
<input type="text" id="paypal_email" class="input3" name="paypal_email" value="<?php echo $row['paypal_email']; ?>" size="37" />
</div>
</div>
謝謝大家!
不能正常工作的意思.. –
你可以想要這樣如果你選擇一個選項然後三個文本框出現,並像這樣在其他選項.. –