The following snippet sits inside a function that validates various textbox fields, which are validated onsubmit. I have other calculations in other functions and I want to stop the form form submitting if those other calculations don't exist. The "total" is calculated on-the-fly, and if no items are selected, then the total box should be empty.
Everything else is working perfectly - it's only this part giving me trouble. How do I stop it from submitting the form if no total has been calculated? I've tried different variations on this code:
alert("No items selected!");