单击复选框时启用文本框 [英] Enabling textbox when checkbox is clicked
本文介绍了单击复选框时启用文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我没有得到以下代码的结果。这里chkWarranty是复选框id,strOriginalRA是文本框id。在该文本框仅被禁用之前。但是当我点击复选框时,它应该被启用。为此,我使用下面的代码,但我没有得到结果。
有人可以帮忙找到这个答案吗?
$( function (){
disabletextbox();
});
function disabletextbox(chkWarranty,strOriginalRA){
if ( document .getElementById( chkWarranty)。checked == true ){
document .getElementById( strOriginalRA)。disabled = false ;
}
else {
document .getElementById( strOriginalRA)。disabled = true ;
}
}
解决方案
( function (){
disabletextbox();
});
function disabletextbox(chkWarranty,strOriginalRA){
if ( document .getElementById( chkWarranty)。checked == true ){
document .getElementById( strOriginalRA)。disabled = false ;
}
else {
document .getElementById( strOriginalRA)。disabled = true ;
}
}
试试这个
(文件)。就绪(函数(){
Hi, everyone
I am not getting the result for below code. Here chkWarranty is the checkbox id and strOriginalRA is the textbox id. Before that textbox is disabled only. But when I am clicking on checkbox it should beenabled. For that I have used below code but I am not getting result.
Can anbody please help to find this answer ??
$(function () {
disabletextbox();
});
function disabletextbox(chkWarranty, strOriginalRA) {
if (document.getElementById("chkWarranty").checked == true) {
document.getElementById("strOriginalRA").disabled = false;
}
else {
document.getElementById("strOriginalRA").disabled = true;
}
}
解决方案
(function () { disabletextbox(); }); function disabletextbox(chkWarranty, strOriginalRA) { if (document.getElementById("chkWarranty").checked == true) { document.getElementById("strOriginalRA").disabled = false; } else { document.getElementById("strOriginalRA").disabled = true; } }
try this
(document).ready(function(){
这篇关于单击复选框时启用文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文