Just a quick question hopefully. What's the best way of storing settings as part of a chunk of html ?
Let me give an example of a photo gallery with lots of photos on the page with the following HTML for each one... <div class="Photo"> <div class="Title">Walking in the park</div> <img src="photos/walkinginthepark.jpg" /> <div class="Rating">Average Rating:<b>6/10</b></div> </div> Somewhere I would like to store a setting for each Photo which says whether the user has voted on the photo yet or not. This setting would be set originally when the page was created and also would be changed by Jquery scripts when the user rates the photo. The problem is that I can't just create a variable in jscript because I don't know how many photos there will be on each page. I can think of three ways to possibly do it. 1) Use hidden input fields like this.... <div ID="Photo-12345" class="Photo"> <input type="Hidden" ID="HasVoted-12345" value="true" /> <div class="Title">Walking in the park</div> <img src="photos/walkinginthepark.jpg" /> <div class="Rating">Average Rating:<b>6/10</b></div> </div> Bit slow and messy but would work ? 2) Add non-html attributes to the div tag <div class="Photo" HasVoted="True"> <div class="Title">Walking in the park</div> <img src="photos/walkinginthepark.jpg" /> <div class="Rating">Average Rating:<b>6/10</b></div> </div> Very messy and not allowed HTML ? 3) Using some sort of array in the Jquery code to remember the state of all of the photos on the page. Not sure how I'd create this array when the page is first created by my asp.net code, or update it if partial page updates added or removed photos from the page. There must be a standard, accepted way of doing this ? The in-built toggle function must use something like this to remember the state of stuff you've clicked ? Any help would be really appreciated.