Alright, admittedly there are a lot of words here, but this is a problem I've never seen before, and quite a peculiar one at that. So, it will probably be worth the read.
I have a page that dynamically produces Listviews in response to a link clicked from $.mobile.autocomplete.
The listview has two types of <li>'s
, and are themed accordingly and have a class set accordingly.
Lets call them l-1 and l-2.
When I click on l-1, what should happen is the following:
What should happen when I click l-2, is that the list is replaced by another list that is the next level down on this particular hierarchy. (I don't think that l-2 has anything to do with this particular issue, and include only for clarity)
A little tricky to implement, but nothing that wasn't straightforward once I figured it out. And it works .... sort of.
All that was just background. Here is the issue:
If I go to the page once, select an item and then go through the steps above, everything works as expected. (We're just going to look at l-1 here). I can generate a listview through autocomplete as many times as I like, click an l-1 listitem, the style is applied, the ajax fires successfully, the success/fail element is highlighted, voila!
I'm happy, and pat myself on the back encouragingly.
However, and this is where the real weirdness begins -
Let's say that I leave the page by going back to the home page (not using the back-button, but just a straightforward jQuery Mobile link), and then once there, I click on the link to bring me back to this page, and I'm back to (lets say the page in question is called Page-2). On Page-2 things start off well: I generate the list using autocomplete, but when I click on an l-1 item, the following happens (or doesn't):
If I leave and come back to Page-2, (this now my third visit) the same thing happens, except:
This pattern continues (presumably for awhile - I tried up to 8 times) in the following manner:
Any Insight?