How To Make Keypress Event Of Asp Textbox?
Hi all i am writing calculation of varius asp textbox controls. I want my calculation being done with keypress event. Below code i am using but not working .aspx page
Solution 1:
Missing "
at the end of id of textbox.
Change
<asp:TextBox ID="txtMaintCost onkeypress="calculateFinanceDetail(); returnfalse;" runat="server"></asp:TextBox>
To
<asp:TextBoxID="txtMaintCost"onkeypress="calculateFinanceDetail(); return false;"runat="server"></asp:TextBox>
Try using the ClientID of server controls. You might not having static ids for server side controls. You do not have to use wild cards if you have fixed ids.
functioncalculateFinanceDetail() {
var txtMaintCost = $('input[id=<%=txtMaintCost.ClientID%>]').val();
var txtInstallCost = $('input[id=<%=txtInstallCost.ClientID%>]').val();
var txtFreightCost = $('input[id=<%=txtFreightCost.ClientID%>]').val();
}
Solution 2:
You're missing quotes here ID="txtMaintCost onkeypress="
, it should be ID="txtMaintCost" "onkeypress="
Post a Comment for "How To Make Keypress Event Of Asp Textbox?"