Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:00:34+00:00 2026-05-31T00:00:34+00:00

I am creating a social website based on jquery mobile. Pages are loaded dynamically

  • 0

I am creating a social website based on jquery mobile. Pages are loaded dynamically using AJAX and are cached in DOM (jQM manages this). I have a chat system on the site: when user click on a name on the contact list page (/chat/), a page with the conversation history with the selected contact loads (/char/msg/?u=user_name).

The problem: when user is chatting with multiple (n) users at the same page, n instances of the conversation page will be loaded and stored on the DOM (/chat/msg/?u=user_1, /chat/msg/?u=user_2, …, /chat/msg/?u=user_n). IDs of elements on the conversation page will inevitably conflict which will break the chatting functionality.

How should I manage the conversation pages to avoid ID conflicts? Destroying all other conversation pages when switching to one is not an option — I would like to support fast-switching between the conversations. I noticed that GMail and Facebook assign random unique ID in such cases but that’s the best practices of doing this? Is there a pattern that I can make use of? And is there a simpler solution?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:00:35+00:00Added an answer on May 31, 2026 at 12:00 am

    This is a common issue when getting used to jQuery Mobile. The solution is that if you find yourself using the same ID on multiple pseudo-pages, then stop, and make them classes instead. It’s as easy as changing the id attribute to class for any element that uses an ID in a non-unique way.

    Here is an example:

    <div data-role="page" id="some-page">
        <div data-role="content">
            <ul class="page-list">
                <li class="first-list-item"></li>
            </ul>
            <a class="back-btn" data-role="button" href="#">Back</a>
        </div>
    </div>
    

    You can then use $.mobile.activePage.find('.back-btn') to find the back button for the current page, or you could use $('#some-page').find('.back-btn') to target a specific back button.

    Basically my suggestion boils down to using page ids as the unique part of your selectors and then using classes for anything more specific so each page can have the same structure. This will help you write re-usable code as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently creating a website for a social project in switzerland. And before there
We are thinking to use Dotnetnuke(ASP.NET) as platform for creating asp.net based social networking
I'm creating a Facebook-like social-network website. For my wall, I have many different kind
I am creating a social networking type website. The website is doing great in
I am creating a social network website on visual web developer, and I am
I am not very familiar with java-script/ jquery. i am creating a sliding social
I am creating a simple design for a social-networking site using the MVC paradigm(in
I'm creating a website using MVC3, I'm using the razor syntax to create the
I am creating a social bookmarking app. I am having a re-thought of the
I'm planning on creating a social networking + MP3 lecture downloading / browsing /

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.