title: $('#textboxId').val()  returning old value (browser cache issue)
body: <p>I can't figure this out despite spending hours. I have a simple dynamically created page (a vbhtml that is loaded using a controller) with two text boxes.</p>
  
  <p>There is a save button on the page. This button invokes an in-page Javascript function. In the function I have these lines:</p>
  
  <pre><code>function saveData()
  {
  var lDescr = $('#FundNote').val();  // FundNote is the id of a textbox
  var DocUrl = $('#DocUrl').val();  // DocUrl is the id of another textbox
  alert(lDescr);
  alert(DocUrl);
    //ajax call to a controller
  }
  </code></pre>
  
  <p>The issue is that every time this page displayed, these variables continue returning the same values as entered the very first time. If I clean browser cache, the newly entered values are returned but then it keeps returning the same values until the browser cache is cleaned again.  Every time this page is displayed, the text boxes are empty and user enters values, so the page itself is not being holding up the values.</p>
  
  <p>Any pointers?</p>
  
  <h2>UPDATE</h2>
  
  <p>After spending days, this is how I fixed it (temporarily).</p>
  
  <p>It appears that even though the controller is sending the updated html and was displayed ok on the browser (the html includes a dropdown box, which is dynamically filled with different values.  Everytime the values are different but in javascript, old values are being returned (for example, old value of the select option, the value did not even included in the current rendering of the html). Still no idea why this is happening.  There are other similar pages in the solution and they work fine.).</p>
  
  <p>Anyway, what I did (for now to make it working), I added a RandonNo() property in the class that dynamically creates this html (via a controller and a vbhtml file). Then in the vbhtml, I appended this randon number to all html component ids.  I also passed the same number to the javascript "<code>Save()</code>" function like this <code>OnClick="Save('@Model.RandonNo')</code>.  In the Save method, then I changed <code>$('#idOption') to $('#idOption-'+ randomno)</code>.  It seems to be working because the ids are different everytime.</p>