How do I loop through attr("rel") to get the one I selected.
I have a dynamic div create an image click or ipad tap.
- $("#pgNum").live("click, tap", function () {
- var v = $("#book").turn("view");
- var rel = $("#pgNum").attr("rel");
- var spl = rel.split("x");
- var pgClicked = parseFloat(spl[0]);
- $("#book").turn("page", parseInt(pgClicked));
- $("#ContentTitle").fadeOut(1000);
- $("#CView").val(v[0] + " - " + v[1]);
- });
My c# code loads the a table of contents from the databases and put them into this:
- <div id="contents" class="clscontents" rel="1 Front Cover">
- <ul>
- <li> <a href="#" id="pgNum" rel="1 Front Cover"></a>l</i>
- <li> <a href="#" id="pgNum" rel="2 IFC"></a>l</i>
- <li> <a href="#" id="pgNum" rel="3 Table of Contents"></a>l</i>
- <li> <a href="#" id="pgNum" rel="6 Visual Index"></a>l</i>
- <li> <a href="#" id="pgNum" rel="24 Layering Light"></a>l</i>
- <li> <a href="#" id="pgNum" rel="28 Clearing Crystal"></a>l</i>
- </ul>
- </div>
What I need is when a user chooses a page to go like 28 Clearing Crystal goto page 28 or if 6 Visual Index goto page 6.With code below and above which is the same code it only goto page 1 no matter what page I click.
- $("#pgNum").live("click, tap", function () {
- var v = $("#book").turn("view");
- var rel = $("#pgNum").attr("rel");
- var spl = rel.split("x");
- var pgClicked = parseFloat(spl[0]);
- $("#book").turn("page", parseInt(pgClicked));
- $("#ContentTitle").fadeOut(1000);
- $("#CView").val(v[0] + " - " + v[1]);
- });
somehow I need to loop and what was selected = pgClicked
thank you in advance.