【发布时间】:2016-12-13 18:07:36
【问题描述】:
HTML
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="payment_options" value=1 autocomplete="off" checked>Cash on Delivery
</label>
<label class="btn btn-default" id="bkash-radio">
<input type="radio" name="payment_options" value=2 autocomplete="off">bKash
</label>
</div>
<input type="hidden" name="trx_id" id="trx_id" class="form-control" placeholder="Enter Transaction ID"/>
jQuery函数:
$(document).on("click", "#bkash-radio", function() {
console.log('test');
$("#trx_id").attr("type", "text");
});
$(document).on("blur", "#bkash-radio", function() {
console.log('test');
$("#trx_id").attr("type", "hidden");
});
我正在尝试在选择第二个无线电选项时显示TextBox ID = TRX_ID,但是当取消选择时,我希望要隐藏的文本框。我该怎么做?
【问题讨论】:
-
您的代码已经在这样做了。不是吗?
-
不。但 Roko 的回答对我有用。
标签: javascript jquery html hide