How I can add and remove the attribute "readonly" ?
Posted
by question_about_the_problem
on Stack Overflow
See other posts from Stack Overflow
or by question_about_the_problem
Published on 2010-03-22T23:17:32Z
Indexed on
2010/03/22
23:21 UTC
Read the original article
Hit count: 297
$(document).ready(function() {
//Check City Value
var city_value = parseInt($("#city").val());
if( city_value == 0) {
$("#state").attr("readonly", true);
//$("#rate").attr("readonly", "readonly");
} else {
$("#state").removeAttr("readonly");
//document.getElementById("state").removeAttribute("readonly",0);
//get_states(city_value);
}
/***
//Check State Value
var state_value = parseInt($('#state').val());
if( state_value == 0) {
$('#rate').attr('readonly', true);
} else {
$('#rate').attr('readonly', false);
}
***/
});
© Stack Overflow or respective owner