I have to enable a number type box when a (Qty)radio button is clicked.And disable when (rate) radio button is clicked.
my view
<input type="radio" class="radioBtn" name="quantity" value="yes" id="rad1" onclick="radio()"/>PRN
<input type="radio" class="radioBtn" name="quantity" value="no" id="rad2" onclick="radio()" />Qty
<input type="number" name="someid" id="textfield" disabled/>
my javascript
$(".radioBtn").click(function radio() {
$("#textfield").attr("disabled", true);
if ($("input[name=quantity]:checked").val() == "yes") {
$("#textfield").removeattr("disabled");
}
});
my link to connect view and js
I'm not sure if this will work on your end but seems good here. Just change removeattr to removeAttr
$("#textfield").removeAttr("disabled");
Also make sure you're including JQuery in your site. For a better insight into why something might not be working, press F12 to open the console in a browser. This will show any errors.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.