gpt4 book ai didi

javascript - 如何使用 jQuery 隐藏元素?

转载 作者:行者123 更新时间:2023-11-27 23:25:25 46 4
gpt4 key购买 nike

<分区>

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");
});

我试图在选择第二个单选选项时显示文本框 id=trx_id,但在取消选择时我希望隐藏文本框。我该怎么做?

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com