android - Having multiple button with Same Id to bind jquerymobile in Phonegap -


i having many pages in phonegap android app. sometime come previous page. planning add 1 button in pages. in such case need have many buttons different id , need bind id's event listener. overcome , can have same id buttons , have bind 1 id , perform require action in function. or suggest me better idea overcome scenario.

first there's easy way add button pages. add attribute:

data-add-back-btn="true" 

to page div data-role="page" , jquery mobile automatically generate button.

official documentation can found here: http://jquerymobile.com/demos/1.2.1/docs/toolbars/docs-headers.html

working example: http://jsfiddle.net/jpjh4/

or there's solution, if want choose location of buttons can create buttons , add attribute them (no need href):

data-rel="back" 

it automatically server button.

<a data-role="button" data-rel="back">back</a> 

working example: http://jsfiddle.net/fs3j3/


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -