|
|
|
ช่วยหน่อยครับ select dropdown แล้วให้ input type text readonly ยังไงครับ |
|
|
|
|
|
|
|
ช่วยหน่อยครับ select dropdown แล้วให้ input type text readonly ยังไงครับ
- คือถ้าเลือก option value='1' แล้วให้ input type ="text" มัน readonly
Code (PHP)
<div class="form-group">
<label class="xCNLabelFrm"><span style="color:red">*</span><?php echo language('payment/cardtype/cardtype','tCTYStaPay')?></label>
<select required class="selectpicker form-control" id="ocmCtyStatusPay" name="ocmCtyStatusPay" data-live-search="true" data-validate="<?php echo language('payment/cardtype/cardtype','tCTYValidStatuspay')?>">
<option value=""><?php echo language('payment/cardtype/cardtype','tCTYStaPay')?></option>
<option value='1' <?php echo (isset($tCtyStatusPay) && !empty($tCtyStatusPay) && $tCtyStatusPay == '1')? "selected":""?>>
<?php echo language('payment/cardtype/cardtype','tCTYTopupfirst')?>
</option>
<option value='2' <?php echo (isset($tCtyStatusPay) && !empty($tCtyStatusPay) && $tCtyStatusPay == '2')? "selected":""?>>
<?php echo language('payment/cardtype/cardtype','tCTYPayLater')?>
</option>
</select>
</div>
Code (PHP)
<div class="form-group">
<label class="xCNLabelFrm" id="tCTYExpire"><?php echo language('payment/cardtype/cardtype','tCTYPaylimit')?></label> <!-- เปลี่ยนชื่อ Class -->
<input type="text" class="form-control xCNInputNumericWithDecimal text-right" id="oetCtyPaylimit" name="oetCtyPaylimit" onclick="JCNdValidateComma('oetCtyPaylimit',3,'FC');" onfocusout="JCNdValidatelength8Decimal('oetCtyPaylimit','FC',3,'<?php echo $tDecSave?>')" value="<?php echo $tCtyPaylimit;?>"
data-validate="<?php echo language('payment/cardtype/cardtype','tCTYValidPaylimit')?>"> <!-- เปลี่ยนชื่อ Class เพิ่ม DataValidate -->
</div>
Tag : PHP, HTML, HTML5
|
|
|
|
|
|
Date :
2019-10-27 20:14:12 |
By :
Mariner |
View :
1593 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<form>
<select>
<option value="0">0</option>
<option value="1">1</option>
</select>
<input value="test">
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('form').on('change','select',function(e){
if($(this).val() == 0)
{
$('input').removeAttr('readonly');
}else{
$('input').attr('readonly','readonly');
}
});
});
</script>
|
|
|
|
|
Date :
2019-10-27 21:11:38 |
By :
Genesis™ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|