How I can add and remove the attribute "readonly"?
<pre><code>$(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);
  }
  ***/
});
</code></pre>

<p>Here is my sample codes.</p>

<pre><code>&lt;td&gt;&lt;select name="city" id="city"&gt;
&lt;option value="0"&gt;PLEASE_SELECT_TEXT&lt;/option&gt;
&lt;option value="Antalya"&gt;Antalya&lt;/option&gt;
&lt;option value="Bodrum"&gt;Bodrum&lt;/option&gt;
&lt;option value="Istanbul"&gt;Istanbul&lt;/option&gt;
&lt;/select&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;div id="states"&gt;&lt;input type="text" name="state" value="FORCE_FOR_SELECT" readOnly id="state"&gt;&lt;/div&gt;&lt;/td&gt;
</code></pre>

<p>I've also added doctype:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
</code></pre>
