I have a variable which contains an item number ... like this:
myvariable = '3'; //Note: This is currently a string so it might need converting?
Then I have the code which populates the listview:
$('#listview').live("pageinit", function(){
$.getJSON("myjson.json", function(data){
$.each(data.unis, function(index, value){
$('<li><a class="listitem" href="#">' + value.name + '</a></li>').insertAfter('#' + value.sortLetter);
$('#' + value.sortLetter).show();
});
$("#listview").listview("refresh");
});
All the above works fine.
Now, what I need to do it to insert a class into the item which is at the position myvariable value.
So, if myvariable is 3 then the listview will look like this:
<ul>
<li><a class="listitem" href="#">' + value.name + '</a></li>
<li><a class="listitem" href="#">' + value.name + '</a></li>
<li><a class="listitem AddedClassHere" href="#">' + value.name + '</a></li>
</ul>
if myvariable was to be 1 then:
<ul>
<li><a class="listitem AddedClassHere" href="#">' + value.name + '</a></li>
<li><a class="listitem" href="#">' + value.name + '</a></li>
<li><a class="listitem" href="#">' + value.name + '</a></li>
</ul>
and so on...
How could I do this?