How do i count #total value + 170 with jquery?
$("#member").click(function() {
if ($('#member').is(':checked')) {
var totalv = $("#total").val();
var skatz = 170;
var skaits = totalv + skatz;
$("#total").val(skaits);
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should check if the provided value is actually a number (You can do onkeypress or keyup each time but I say you should always check on submission). Below is your code modified to work (With checks to see if the value is a number).
EDIT: Make sure that your javascript has document ready wrapped around it. (Functions can be outside of this call)