Reputation: 75
Following is my javascript code,is there a way to make checkbox and textbox readonly?
//display textboxes and checkbox when condition is true.
if($$("id").value =="something"){
document.getElementById("textboxl").style.display="";
document.getElementById("chkbox1").style.display="";
document.getElementById("textbox2").style.display="";
document.getElementById("chkbox2").style.disable="";
}
I have to display and then disable it(i mean make it readonly).
Upvotes: 1
Views: 1299
Reputation: 150313
Update:
element.readOnly = true
Set readonly
with:
$('#chkbox1').prop('readonly', true);
Or:
$('#chkbox1').attr('readonly', 'readonly');
display can be done with:
$('#chkbox1').show();
Or with:
$("#chkbox1").css('display', 'block');
Upvotes: 1