$(document).ready(function() {
//Check City Value
var city_value = parseInt($(\"#city\").val());
if( city_value == 0) {
$(\"#state\").attr(\"readonly\", true)
Works fine here in all major browsers I have. Here's an SSCCE:
SO question 2496443
Toggling it turns the background gray (although not all browsers do that) and the input is uneditable (this is consistent among all webbrowsers). So your problem lies somewhere else. You're probably using a poor doctype and possibly also in combination with a poor webbrowser.