Before you ask, and someone always does, these examples will currently work in the following browsers: Safari 5, Chrome 6, Opera 9, Firefox 4 Beta and the i Phone/i Pad.
Also each browser has a slightly different default behaviour.
These methods are very convenient to use, but they do not provide the functionality of clearing all the fields, including their default values.
In order to achieve this, we would need to write a Java Script function that would clear each individual field’s value.
All of this code will be executed by the runtime synchronously, in a single turn through the event loop .
Another way to think about this is that method calls which operate synchronously are a special case of the more general asynchronous case.
I’ll highlight the difference between testing a unit of code which supports async behavior, as opposed code which is inherently asynchronous.
I’ll also show how promise-based async code lends itself to clean and succinct unit tests which can be tested in a clear, readable way while still validating async behaviour.
Validate qty of checkboxes in a group (same name) have been checked, using min, max or range.
Let us set default values for some of the form elements.