Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Mobile $('#idoftheinputfield').val() always returns the first value entered
    text
    copied!<p>After looking at several related posts for couple of days I decided to post this question for which I still don't have an answer. </p> <p>I have a jquery mobile page with an input field of type "search" and have a keyup function for the field to call another page with the current value of the field if an enter key is pressed. Every thing works fine first time I type in a value and press the enter key. But then on , it always gets the very first value (previous value) I entered and never gets the newly changed value. I have seen related posts, but couldn't figure out the solution for my issue. Issue is same on all browsers I had tested so far, on computer and on mobile.</p> <p>Here is input field</p> <pre><code>&lt;div class="content-primary" data-dom-cache="false"&gt; &lt;input type="search" name="finddata" id="search-team" value="Find Data" data-inline="true"/&gt; &lt;/div&gt; </code></pre> <p>Here is the script function</p> <pre><code>$(document).on('keyup','#search-team',hndlSearchTmKeyup); function hndlSearchTmKeyup(event) { if (event.which == 13) { alert("search!oo! ="+$("#search-team").val()); window.location.assign("/myapp/mysearchpage.jsp?findTmNm="+$("#search-team").val()) return false; } } </code></pre> <p>After further testing I found out that if I just display an alert in the hndlSearchTmKeyup function without calling the window.location.assign it displays the new value correctly. When I include the window.location.assign and from the next page when I click the "home" button and return to the original page and again type in a new value and press enter it shows the old value. Not sure what is going on.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload