I have a table and want to add a listener to it to detect if input boxes loses focus. Currently I using .blur function for each input box but in future more rows could be added and want to cater for that.
JQUERY:
$('#ClaimCapture_LineItems_ctl01_txtCode').blur(function () {
var tariffCode = $('#ClaimCapture_LineItems_ctl01_txtCode').val();
DisbaleControls(tariffCode);
});
UPDATED:
JQUERY:
$("#ListingInfo").delegate("input", "blur", function () {
var tariffCode = $(this).val();
DisbaleControls(tariffCode);
});
HTML:
<TABLE class="Listing" id="ListingInfo" cellSpacing="0" cellPadding="0">
<TR>
<TD id="tdRdd" colSpan="10"><B>
<asp:Literal id="lblRDDQuestion" runat="server"></asp:Literal></B></TD>
</TR>
<TR>
<TD id="tdCat" colSpan="10"><B>
<asp:Literal id="lblCatQuestion" runat="server"></asp:Literal></B></TD>
</TR>
<TR>
<TD colSpan="10"><STRONG>Please enter in your line items:</STRONG>
</TD>
</TR>
<asp:Repeater id="LineItems" Runat="server">
<HeaderTemplate>
<tr class="Header">
<td width="28">#</td>
<td width="30">Qty</td>
<td width="60">Tariff</td>
<td width="170" align="left">Description</td>
<td width="78">ICD Codes</td>
<td width="68" align="right">Invoice</td>
<td width="68" align="right">Medical</td>
<td width="68" align="right">Patient</td>
<td width="68" align="right">Discount</td>
<td width="50">Rej #</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr class="Normal">
<td><%# DataBinder.Eval(Container.DataItem, "Number") %></td>
<td>
<asp:TextBox ID="txtQuantity" Runat="server" Width="13px" MaxLength="2" onChange="jsCheckQuantities(this)" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>' /></td>
<td>
<asp:TextBox ID="txtCode" Runat="server" Width="40px" MaxLength="8" onChange="jsCheckCodes(this,ClaimCapture_txtTariffs,ClaimCapture_txtLaboratory,ClaimCapture_txtNVSTag);" Text='<%# DataBinder.Eval(Container.DataItem, "Code") %>' /></td>
<td>
<asp:TextBox ID="txtDescription" Runat="server" Width="162px" MaxLength="64" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>' /></td>
<td>
<asp:TextBox ID="txtDiagnosticCodes" Runat="server" Width="72px" MaxLength="64" Text='<%# DataBinder.Eval(Container.DataItem, "DiagnosticCodes") %>' /></td>
<td>
<asp:TextBox ID="txtInvoice" Runat="server" Width="49px" MaxLength="10" CssClass="Amount" onChange="jsFormatAmount(this);" onKeyPress1="return(jsAmountSizeCheck(this, 8));" Text='<%# CurrencySymbol & FormatNumber(DataBinder.Eval(Container.DataItem, "Invoice"), 2) %>' /></td>
<td align="right"><script>getCurrency()</script><%# FormatNumber(DataBinder.Eval(Container.DataItem, "Medical"), 2) %></td>
<td align="right"><script>getCurrency()</script><%# FormatNumber(DataBinder.Eval(Container.DataItem, "Patient"), 2) %></td>
<td>
<asp:TextBox ID="txtDiscount" Runat="server" Width="49px" MaxLength="10" CssClass="Amount" onChange="jsFormatAmount(this);" Text='<%# CurrencySymbol & FormatNumber(DataBinder.Eval(Container.DataItem, "Discount"), 2) %>'/></td>
<td><%# FormatNull(DataBinder.Eval(Container.DataItem, "RejectionCodes")) %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<TR class="Footer">
<TD align="left" colSpan="5">
<asp:LinkButton id="CreateLineItem" Runat="server" Text="Create New Line Item" CommandName="Create"></asp:LinkButton></TD>
<TD align="left">
<INPUT id="txtInvoiceTotal" size="7" value="0.00" name="txtInvoiceTotal">
</TD>
<TD align="right" colSpan="3">NVS Tag</TD>
<TD>
<asp:TextBox id="txtNVSTag" Runat="server" MaxLength="36" Width="40px" Enabled="False"></asp:TextBox>
</TD>
</TR>
</TABLE>
Using jquery 1.6.2 and this still does not solve my issue. I want to put the listener on the texboxes that is in the ItemTemplate
Any help would be appreciated.