why this code not working?!
Hi,
I am using the following to set the text and readonly attribute of textbox when checkbox is clicked but it's not working properly. First when I load the page it works fine.. then I set click the checkbox so it will be readonly and text will change.. then when changing it back to editable it also works but the problem occurs when I change the company name then again click the checkbox to set it to readonly... nothing will work that time..
- $("#chkHideCompanyName").click(function () {
- if ($(this).is(":checked")) {
- $("#txtCompany").attr("value", "Confidential");
- $("#txtCompany").attr("readonly", true);
- } else {
- $("#txtCompany").attr("readonly", false);
- $("#txtCompany").attr("value", "<?php echo $company_name; ?>");
- }
- });