jQuery events don't provide synchronization of input values from other inputs during form submission
<p><br /></p>
<pre class="brush:php;toolbar:false;">$(document).ready(function () {
$('#StaffNumber').on('keyup', function () {
var staffNo = $(this).val();
$('#Username').val('EMP' staffNo);
});
});</pre>
<p>Here the username input is populated with a new value, but the value is not available when the form is submitted. Additionally, I need a field validation on the username that fires on submit even after the value is populated in a jQuery event. How to preserve the value of username?</p>
<p><code>$('#StaffNumber').on('input', function () {...}); </code></p>
<p><code>$('#StaffNumber').on('keyup paste', function () {...});</code></p>
<p>I also tried the above activities, but still no value retained!</p>