Question

It is supposed to display text when you enter in a certain number, but it does not appear to be working. I am using Javascript for a ASP.NET website.:

    <div class="fltlft">
    <%--<asp:TextBox ID="txtCreditPoint" runat="server" AutoCompleteType="Disabled"></asp:TextBox>--%>
    <asp:TextBox ID="txtCreditPoint" runat="server" AutoPostBack="false" AutoCompleteType="Disabled"></asp:TextBox>
    <asp:RequiredFieldValidator ID="rfvCreditPoint" runat="server" ControlToValidate="txtCreditPoint"
        ErrorMessage="Point is required." Text="*" ForeColor="Red" ToolTip="Point is required."></asp:RequiredFieldValidator>
    <asp:RangeValidator ID="rvCreditPoint" runat="server" ControlToValidate="txtCreditPoint"
        ErrorMessage="Point is not valid. Must be 1-10" ForeColor="Red" Text="*"
        MinimumValue="1" MaximumValue="10" Type="Integer"></asp:RangeValidator> <a href="point_value.html" onclick="window.open('point_value.html', 'newwindow', 'width=300, height=125'); return false;" style="font-size: 16px">?</a><br />
    <asp:Literal ID="ltrRecomendedPoin" runat="server"></asp:Literal>
    <br />
    <asp:Label ID="lblUSDValue" Text="" runat="server" ></asp:Label>
</div>

<script>
    $(document).ready(function () {
        $('<%= txtCreditPoint.ClientID %>').change(function () {
            if ($('<%= txtCreditPoint.ClientID %>').val() == "1") {
                $('<%= lblUSDValue.ClientID %>').text("You are valuing this game at a range of $1.00 to $5.00");
            }
        });
    });
</script>

No correct solution

OTHER TIPS

It seems that you're missing a # before all of your references to id's in the jquery portion:

I.E.

$('<%= txtCreditPoint.ClientID %>').val()

should probably be

$('#<%= txtCreditPoint.ClientID %>').val()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top