divtags in which the
data-roleattribute is set to
page. The role of the tags is expressed by the
data-roleattribute in this manner. For example,
data-rolecan also specify as
listview. For more information on jQuery Mobile tags and components, please refer to jQuery Mobile Demo.
initTopPage()function is called. This function is used to initialize the Top page (Home screen). The initialization process is to get all the previously stored memo(s) (using the
getMemoList()function which is defined in the
memo.jsfile) and put them into a list view. If there is no previously created memo (when using the application for the first time),
"No memo found"will be displayed.
+Addbutton, the Add Memo page will be shown. After filling in the Memo text box, the
onSaveBtn()function is called when the
Savebutton is clicked. In this function, the input text will be saved to local storage via the
addMemo()function (defined in the
memo.jsfile) and then it goes back to the Top page with an updated list. Below is the source code of this function:
onShowLink()function (defined in the
memo.jsfile) is called. In this function, the Detail page will be shown and either the title or the full content of the selected item will be displayed as shown below:
onDeleteLink()function is called. In this function, a message confirming the deleting action is shown . If the button is clicked, the selected item will be deleted from the local storage via the
deleteMemo()function (defined in the
memo.jsfile). Then, it will go back the Top page with an updated list.
getMemoList(): get the list of all memo stored in the local
saveMemoList(): save the list of all memo into the local storage.
AddMemo(): add a new memo into the memo list and then save the new
deleteMemo(): delete a specific memo from the memo list and then