title: jquery in editorfor
body: <p>I'm trying to use jquery in asp.net mvc3. I'm using EditorTemplates for the list. My model is as</p>
  
  <pre><code>public class staffinfo
  {
      public int staffid { get; set; }
      public double extgrade { get; set; }
      public string lvlid { get; set; }
      public IList&lt;SelectListItem&gt; level { get; set; }
      public string grdid { get; set; }
      public IList&lt;SelectListItem&gt; grade { get; set; }
      public double pf { get; set; }       
      public double wages { get; set; }
      public List&lt;hrfacility&gt; facility { get; set; }
  
  }
  
  public class hrfacility
  {
      public int id { get; set; }
      public string name { get; set; }
      public double price { get; set; }        
      public int staffid { get; set; }
      public string staffname { get; set; }               
      public double amount { get; set; }
      public bool selected { get; set; }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>...
  @Html.EditorFor(m =&gt; m.wages)    
  @Html.EditorFor(m=&gt;m.facility) 
  </code></pre>
  
  <p>EditorTemplate for hrfacility</p>
  
  <pre><code>@model Mysol.Models.hrfacility
  ...
  @Html.DisplayFor(m=&gt;m.name)
  @Html.CheckBoxFor(m=&gt;m.selected)    
  @Html.EditorFor(m =&gt; m.staffname)
  @Html.EditorFor(m =&gt; m.amount)
  
   &lt;script type="text/javascript"&gt;
      $('#staffname').attr('readonly', true);
  &lt;/script&gt;
  </code></pre>
  
  <p>I've used the above procedure without the list part in editortemplates and the jquery works fine but for this particular situation it is not working!!</p>
  
  <p>Is it because there might be more than one staffname??</p>
  
  <p>How can i make jquery work for the above situation (make staffname readonly)??</p>
  
  <p>P.S. readonly is just for the example purpose. I need to do other things as well with jquery like assigning the value to the textbox. If i can get this work, i think i can do other things as well.</p>
  
  <p>Thanks </p>