enable check box not working
-
I have the following code in my aspx page. for some reason disabled=true/false not working, any idea why? function chkboxlistchecking(chkMed,chkBeh,chkReports) { // Go through all items of a check list control var cbkSelect = document.getElementById(chkMed); var cbkAdd = document.getElementById(chkBeh); var cbkEdit = document.getElementById(chkReports); if(cbkSelect.checked == true || cbkAdd.checked == true ) { cbkEdit.checked=true; cbkEdit.disabled=true; }else { cbkEdit.checked=false; cbkEdit.disabled=true; } }
-
I have the following code in my aspx page. for some reason disabled=true/false not working, any idea why? function chkboxlistchecking(chkMed,chkBeh,chkReports) { // Go through all items of a check list control var cbkSelect = document.getElementById(chkMed); var cbkAdd = document.getElementById(chkBeh); var cbkEdit = document.getElementById(chkReports); if(cbkSelect.checked == true || cbkAdd.checked == true ) { cbkEdit.checked=true; cbkEdit.disabled=true; }else { cbkEdit.checked=false; cbkEdit.disabled=true; } }
You have coded
cbkEdit.disabled=true;
twice. Is this what you mean to do?
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
You have coded
cbkEdit.disabled=true;
twice. Is this what you mean to do?
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
I have the following code in my aspx page. for some reason disabled=true/false not working, any idea why? function chkboxlistchecking(chkMed,chkBeh,chkReports) { // Go through all items of a check list control var cbkSelect = document.getElementById(chkMed); var cbkAdd = document.getElementById(chkBeh); var cbkEdit = document.getElementById(chkReports); if(cbkSelect.checked == true || cbkAdd.checked == true ) { cbkEdit.checked=true; cbkEdit.disabled=true; }else { cbkEdit.checked=false; cbkEdit.disabled=true; } }
-
What are you passing into the function? Are you passing the name of the elements as strings, or passing in as the actual object.
Dave Find Me On: Web|Facebook|Twitter|LinkedIn
Folding Stats: Team CodeProject
-
Exactly what is not working?
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
I have the following code in my aspx page. for some reason disabled=true/false not working, any idea why? function chkboxlistchecking(chkMed,chkBeh,chkReports) { // Go through all items of a check list control var cbkSelect = document.getElementById(chkMed); var cbkAdd = document.getElementById(chkBeh); var cbkEdit = document.getElementById(chkReports); if(cbkSelect.checked == true || cbkAdd.checked == true ) { cbkEdit.checked=true; cbkEdit.disabled=true; }else { cbkEdit.checked=false; cbkEdit.disabled=true; } }
Hi, please alert the value of cbkEdit, and check whether it is a valid object or not.And make sure that the ID is same.
-
Hi, please alert the value of cbkEdit, and check whether it is a valid object or not.And make sure that the ID is same.
-
I have the following code in my aspx page. for some reason disabled=true/false not working, any idea why? function chkboxlistchecking(chkMed,chkBeh,chkReports) { // Go through all items of a check list control var cbkSelect = document.getElementById(chkMed); var cbkAdd = document.getElementById(chkBeh); var cbkEdit = document.getElementById(chkReports); if(cbkSelect.checked == true || cbkAdd.checked == true ) { cbkEdit.checked=true; cbkEdit.disabled=true; }else { cbkEdit.checked=false; cbkEdit.disabled=true; } }
I think u should check the Checklist.clientID. The following code works both in IE and Chrome.
<script type="text/javascript" language="javascript">
function chkboxlistchecking(chkMed, chkBeh, chkReports) { // Go through all items of a check list control var cbkSelect = document.getElementById(chkMed); var cbkAdd = document.getElementById(chkBeh); var cbkEdit = document.getElementById(chkReports); if (cbkSelect.checked == true || cbkAdd.checked == true) { cbkEdit.checked = true; cbkEdit.disabled = true; } else { cbkEdit.checked = false; cbkEdit.disabled = true; } } </script>
<input id="ch_s" type="checkbox">Select</input>
<input id="ch_a" type="checkbox">Add</input>
<input id="ch_e" type="checkbox">Edit</input><br /><button onclick="javascript:chkboxlistchecking('ch_s','ch_a','ch_e');">check</button>
anyway , u can move cbkEdit.disabled=true out of the if statement.
function chkboxlistchecking(chkMed, chkBeh, chkReports) {
// Go through all items of a check list control
var cbkSelect = document.getElementById(chkMed);
var cbkAdd = document.getElementById(chkBeh);
var cbkEdit = document.getElementById(chkReports);
cbkEdit.checked = (cbkSelect.checked == true || cbkAdd.checked == true)
cbkEdit.disabled = true;
}Good day,Good job,Good life