HTML and CSS Reference
In-Depth Information
Clear Task
Next we want to implement the clear task functionality. This should be invoked when the
“Clear Task” button is clicked, but should also be invoked after a save .
There is a very convenient way to implement the clear task functionality. Add the following
code to the private section of tasks-controller.js:
function clearTask() {
We can simply de-serialize an empty object into the form. This will ensure that all form ele-
ments have their content cleared, since they will not find a corresponding value in the object
passed in.
Now we can add the following to the init method of the tasks-controller.js where the other
event listeners were registered:
$(taskPage).find('#clearTask').click(function(evt) {
We also want to invoke clear tasks after a save (we added code for this previously, but it is
worth changing to utilize the new implementation). Change line of code:
to the following:
Search WWH ::

Custom Search