I have a working shopping cart system in which items are added to the shopping cart via jquery ajax calls, and a div on the requesting page is updated using replaceWith to reflect the number of items and amount. It works great. (Incidentally, this div appears in the header of every page).
I’m now working on a jquery mobile (Alpha 4) version. Items get added to the shoppingcart, but the div in question is no longer updated. The particular code that isn’t working is:
$("#cartsummary").replaceWith(html);
I would really appreciate any thoughts on this.
OK, I think I figured it out. JQM adds successive pages to the existing DOM, wrapping each in an id, so that pressing the back button doesn’t require a page load. This means that there can be several copies of my “cartsummary” id on a page. That obviously wouldn’t work. I changed the id to an class, and it worked.