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

  • SEARCH
  • Home
  • 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 8567615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:55:23+00:00 2026-06-11T17:55:23+00:00

I am trying to create a sub listview page separate from the typical caged

  • 0

I am trying to create a sub listview page separate from the typical caged one:

This is what I’m trying to do:

STEP1 – Loops gets all the data and creates the list in the listview:

$(document).ready(function() {

     var data = {"id":[{"id":1,"title":"title1","bodytext":"sometext 1"},{"id":2,"title":"title2","bodytext":"sometext 2"},{"id":3,"title":"title3","bodytext":"sometext 3"}
                   }]

    var output = ''

    $.each(data.id, function(index, value){

       output += '<li><a href="#mypage">'+value.title+'</a></li>';

       $('#mypage').text(value.title); //will this be different for each item?

    });

    $('#mylistview').html(output).listview('refresh'); //Refresh the listview with new added data

});

STEP 2:

The listview now looks like this:

<ul id-"mylistview">
   <li><a href="populate_#mypage_with_data_from_item_1">title1</a></li>
   <li><a href="populate_#mypage_with_data_from_item_2">title2</a></li>
   <li><a href="populate_#mypage_with_data_from_item_3">title3</a></li>
</ul>

STEP 3:

I have a pre-made template:

<div id="mypage">
Data from selected item goes here
</div>

So, if I click on list item 1 mypage will look like this:

<div id="mypage">
Sometext 1
</div>

or if item 2 is clicked:

<div id="mypage">
Sometext 2
</div>

My problem is that no matter which item I click in the listview I always get the data from item 1.

How can I maker it so each item has it’s own data displayed?

  • 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-06-11T17:55:24+00:00Added an answer on June 11, 2026 at 5:55 pm
    $(document).ready(function() {
        var data = {"ids":[
             {"id":1,"title":"title1","bodytext":"sometext 1"},
             {"id":2,"title":"title2","bodytext":"sometext 2"},
             {"id":3,"title":"title3","bodytext":"sometext 3"}]};
    
        var output = '',
            myPages = $('.mypage'),
            container = $('#mylistview');
    
        $.each(data.ids, function(index, value){
           output += '<li><a href="#mypage">'+value.title+'</a></li>';
           myPages.eq(index).text(value.bodytext);
        });
    
        container.html(output);
    
        container.on('click', 'a', function(e){
            e.preventDefault();
            var links = container.find('a');
            alert(myPages.eq(links.index(this)).text());
        });
    }); 
    

    Demo: http://jsfiddle.net/mDnE6/

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

Sidebar

Related Questions

I'm trying to create a batch script that will delete all sub directories which
I am trying to create a list view from the database. this is the
I'm trying to create a sub-query to obtain the latest date from a table,
Trying to create two clients; one is pub/sub, the other is a standard connection.
i'm trying to create a Dynamic Sub-menu to use it in Wordpress, Something like
I'am trying to create a navigation menu with a sub menu, and fiddled with
I am trying to create a multi project template. I wish the sub projects
Trying to create a black line in my view to separate text blocks but
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
I'm trying to create a sub-class of the JButton component that will enable or

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.