I want to create a jquery mobile grid consists of buttons with 'onclick' or 'href' functionality. The number of buttons should be created dynamically during runtime. For example, This block of code should work like a library index. on clicking a library button, it should show the 'book names' in a grid of buttons, and on clicking the buttons of book names, it should show another grid of buttons which consists of 'chapter numbers' in the book which will be created dynamically upon book selection. My static html code for creating the grid is,
<div class="ui-grid-d" id="book_chooser">
<div class="ui-block-a"><button class="ui-bar ui-bar-a" style="height:30px">Book A</button></div>
<div class="ui-block-b"><button class="ui-bar ui-bar-a" style="height:30px">Book B</button></div>
<div class="ui-block-c"><button class="ui-bar ui-bar-a" style="height:30px">Book C</button></div>
<div class="ui-block-d"><button class="ui-bar ui-bar-a" style="height:30px">Book D</button></div>
<div class="ui-block-e"><button class="ui-bar ui-bar-a" style="height:30px">Book E</button></div>
<div class="ui-block-a"><button class="ui-bar ui-bar-a" style="height:30px">Book A</button></div>
<div class="ui-block-b"><button class="ui-bar ui-bar-a" style="height:30px">Book B</button></div>
<div class="ui-block-c"><button class="ui-bar ui-bar-a" style="height:30px">Book C</button></div>
<div class="ui-block-d"><button class="ui-bar ui-bar-a" style="height:30px">Book D</button></div>
<div class="ui-block-e"><button class="ui-bar ui-bar-a" style="height:30px">Book E</button></div>
<div class="ui-block-a"><button class="ui-bar ui-bar-a" style="height:30px">Book A</button></div>
<div class="ui-block-b"><button class="ui-bar ui-bar-a" style="height:30px">Book B</button></div>
<div class="ui-block-c"><button class="ui-bar ui-bar-a" style="height:30px">Book C</button></div>
<div class="ui-block-d"><button class="ui-bar ui-bar-a" style="height:30px">Book D</button></div>
<div class="ui-block-e"><button class="ui-bar ui-bar-a" style="height:30px">Book E</button></div>
Need this grid of buttons should to be created dynamically on run time based on the number of books.
I'm using jquery, javascript and html5 with phonegap plugin.
Please help.
Thanks in advance.