mgmhicks
asked on
Help with jquery to change value in textbox control
I have a checkbox called cboFee and a textbox called txtAmount. When someone clicks on the checkbox I need to add $20.00 to the amount field. if the checkbox is unchecked I need to subtract from it. This needs to be done in jquery because I don't want to do a call back. Could someone give me sample code and how this would work.
thanks
thanks
ASKER
this is what I have because of master page
$("#<%=cbxfee.ClientID %>").change(function() {
if ($(this).is(":checked")) {
$("#<%=txtAmt.ClientID %>").val(parseFloat($("#<% =txtAmt.Cl ientID %>").val() + 20))
}
else {
$("#<%=txtAmt.ClientID %>").val(parseFloat($("#<% =txtAmt.Cl ientID %>").val() - 20))
}
})
});
seems like when it adds it appends the value put when it subtracts it does subtract it. I start off with 0.00 , check the box and I get 0.002 then I click it again I get, -19.998
so we are close
thanks
$("#<%=cbxfee.ClientID %>").change(function() {
if ($(this).is(":checked")) {
$("#<%=txtAmt.ClientID %>").val(parseFloat($("#<%
}
else {
$("#<%=txtAmt.ClientID %>").val(parseFloat($("#<%
}
})
});
seems like when it adds it appends the value put when it subtracts it does subtract it. I start off with 0.00 , check the box and I get 0.002 then I click it again I get, -19.998
so we are close
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
Open in new window