title: Unable to use "oninput" event in JSP. What are the alternatives?
body: <p>I am working on a JSP page that contains an input box that takes in a date. I want to convert that time into another timezone and autofill the other input box. I tried to do this by using oninput event to call a JS function but when I change the input in the first input box, nothing appears in the second input box accordingly. I am new to JSP and JS. I am wondering what am I doing wrong here. What is the right way to implement such a function.</p>
  <p><strong>My JSP:</strong></p>
  <pre><code>&lt;tr&gt;
  &lt;td&gt;Final Date&lt;/td&gt;
  &lt;td&gt;
  &lt;input type=&quot;text&quot; name=&quot;finalDate&quot; id=&quot;datepicker&quot; oninput=&quot;convertTime('datepicker', 'CST')&quot;/&gt;
  &lt;/td&gt;
  &lt;td&gt;CST&lt;/td&gt;
  &lt;td&gt;
  &lt;input type=&quot;text&quot; name=&quot;cstTime&quot; id=&quot;CST&quot; /&gt;
  &lt;/td&gt;
  </code></pre>
     
  <p><strong>My JS:</strong></p>
  <pre><code>function convertTime(iID, oID) {
  var LA    = moment.tz(document.getElementById(iID).value, &quot;America/Los_Angeles&quot;);
  var PST = new Date(LA);
  
  document.getElementById(oID).value = PST.toLocaleString('en-GB', { timeZone: 'CST' });
  }
  </code></pre>