data-, such as
data-position, serve special roles in jQuery Mobile.
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
addTodo, are defined. As the names imply, the first function shoots a photo and registers data while the second performs only data registration.
navigator.camera.getPicture,which is a function provide by Core Cordova Plugins. If the call is successful, the function
addTodois then executed. if it fails, an error message is generated. Photo shoot options such as fixing the image size and specifying the return type are also set.
addTodotakes an argument called
camera_url. When the function
navigator.camera.getPictureis called and the photo shoot is successful, a reference to the graphic file is stored in this argument.
todo-titleis acquired and assigned to the variable
14-19, the input values are read and assigned to the appropriate variables
img_tag. Next, the function
$.mobile.changePagetransitions to the next page and adds a new row to the list. Finally, the list page is redrawn and the program ends.