$(document).ready(function() { //Check City Value var city_value = parseInt($(\"#city\").val()); if( city_value == 0) { $(\"#state\").attr(\"readonly\", true)
While the readonly property takes a boolean value, the readonly attribute takes a string value. You should use the code that you have commented out:
readonly
$("#rate").attr("readonly", "readonly");