how can a call a function when text value of my textbox changes using jquery?
<p>I have 3 input fields which have values prepopulated and a constant value of total hours 200. I am calculating the avghours as totalhours/datediff of date1 and date2.</p>

<p>My Question is if i change the value of date2 then i want the avghours value to change accordingly. I am not sure which event should be used to fire the method which does the calculation</p>

<pre><code>&lt;input type="text" id ="avghours"/&gt;
&lt;input type="text" id ="date1"/&gt;
&lt;input type="text" id ="date2"/&gt;
</code></pre>

<p>Javascript code</p>

<pre><code> function getavg()
 {

 $('#avghours').val()=totalhours/datediff($('#date2').val(),$('#date1').val(),'day');//datediff is userdefined function to get the datedifference


 }
</code></pre>

<p>change will fire only if the focus is lost so that might not be possible is there anyother event that i can use. </p>

<p>Thanks</p>

<p>Prady</p>
