I can't wrap my head around this javascript, could someone please help me with this?
I have a field called "Student Count" with class = student
A field called "Additional Pay" with class = additional
If Student Count is more than 10 (for example 12), then "additional" = 12 * 25 (12 being the number of students, 25 being a fixed number if the Student Count is larger than 10).
If Student Count is more than 20 (for example 26), then "additional" = 26 * 50 (26 being the number of students, 50 being a fixed number if the Student Count is larger than 20).
Here is the start of my code:
$(document).ready(function(){ $(".student input").change(function(){ var student = $(".student input").val(); if (student >= "10" ) { $(".additional input").val($(".student input" * 25).val()); else if (student >= "20" ) { $(".additional input").val($(".student input" * 50).val()); } });
Thank you!