I need to do a maths calculation based on a user selecting a drop down option and choices from checkbox items on my register form.
I have a drop down option labelled "Type of listing required" and contains two options:
- Featured (£25 per month per area)
- Standard (£10 per month per area)
We also have 3 checkbox items underneath this drop down which are labelled "Which area/areas do you serve?":
- Altrincham
- Hale
- Sale
After a user has selected an option from "Type of listing required" and their choices from "Which area/areas do you serve?" I want to show a total price to them before the submit button.
The calculation is ("Type of listing required") multiplied by the number of ("Which area/areas do you serve?")
So if a user selects "Standard (£10 per month per area)" then ticks ALL 3 checkbox options (Altrincham, Hale, Sale) I want to show a message that says "The total cost is £30 per month". This would be the result of £10 times 3.
If a user selects "Featured (£25 per month per area)" then ticks ANY 2 checkbox options (Altrincham, Sale) I want to show a message that says "The total cost is £50 per month". This would be the result of £25 times 2.
If a user selects "Featured (£25 per month per area)" then ticks ANY 1 checkbox option (Hale) I want to show a message that says "The total cost is £25 per month". This would be the result of £25 times 1.
How would I go about this in jQuery?
Thanks
Aucun commentaire:
Enregistrer un commentaire