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 9229185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:30:34+00:00 2026-06-18T05:30:34+00:00

I have list view in jQuery Mobile web app this list view is made

  • 0

I have list view in jQuery Mobile web app this list view is made of elements like this:

<li id='search_r'>
    <a href='#' id='$id' class='s_result'></a>
</li>
<li id='search_r'>
    <a href='#' id='$id' class='s_result'></a>
</li>

Number of element depends on number of search results, its not only these two.
When I click on element in list view, in this case:

<li></li>

I need 2 things to happen, one is to assign the ‘id’ attr from “a” tag inside this specific “li” tag (the clicked one), to the global variable I have called ‘search_r’. The click event works fine, but to get attribute from “a” tag I can’t manage to do.

Here is my js:

$("#cc_page").ready(function(){
  $("#search_r").live('click', function(){
      search_r = $(this).attr('id');
      window.location.href = "http://imes.********.com/app/userpanel.html#sfpp_page";
  });
});

I know “this” is not solution. I’m really new to js so that’s why I’m asking such an ridiculous questions 🙂

  • 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-18T05:30:36+00:00Added an answer on June 18, 2026 at 5:30 am

    The first problem you’ve got is duplicate search_r id attributes, which is invalid. These should be changed to classes. Also, you should be using on() with a delegate handler, as live() has been removed from the latest version of jQuery. Try this:

    <li class='search_r'>
        <a href='#' id='$id' class='s_result'></a>
    </li>
    <li class='search_r'>
        <a href='#' id='$id' class='s_result'></a>
    </li>
    
    $("#cc_page").on('click', '.search_r', function(){
        var search_r = $('a', this).attr('id');
        console.log(search_r); // just to check it works
    
        // I assume this is just for testing, otherwise leaving the page 
        // immediately on click renders getting the id completely moot.
        //window.location.href = "http://imes.********.com/app/userpanel.html#sfpp_page";
    });
    

    I also assume the $id in your HTML is from some form of templating engine which gets interpreted? If not, those will also need to be made unique.

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

Sidebar

Related Questions

I have a list view in jQuery Mobile with delete buttons in them. <ul
I'm building a mobile web app with jQuery Mobile and I have a problem.
I have a JQuery Mobile (1.0rc1) application that has a list view with a
I'm developing a web app with jquery mobile and Bootstrap,however I have a problem
I currently am using a dynamically generated list view in jQuery mobile to display
I built a listview using jquery mobile. However, I would like to have a
Has anyone come up with any solution to the JQuery Mobile UL List View?
I have implemented an iphone app using phonegap and jQuery mobile. I used Auto-Dividers
I'm working on application where I have a custom made List View, with image
I have a single page jQuery mobile application that consists of several list views

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.