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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:45:39+00:00 2026-06-05T14:45:39+00:00

I’m following a tutorial here: http://blog.chariotsolutions.com/2012/01/from-list-to-details-view-using.html I am trying to dynamically bind a click

  • 0

I’m following a tutorial here: http://blog.chariotsolutions.com/2012/01/from-list-to-details-view-using.html

I am trying to dynamically bind a click handler to a listview item as it is rendered. The method described in the link above does not work. I have tried several alternatives..

The tutorial suggests this in the render function: (template is below)

    activities.each(function(activity){
        var renderedItem = template(activity.toJSON()),
        $renderedItem = $(renderedItem);  //convert the html into an jQuery object
        $renderedItem.jqmData('activityId', activity.get('id'));  //set the data on it for use in the click event
        $renderedItem.bind('click', function(){
           //This part is different in tutorial, but irrelevant
           alert("Hello.");
           alert($(this).jqmData('activityId'));    //'this' represents the element being clicked
        });
        listView.append($renderedItem);
    });

This does not work. The buttons get created, but nothing happens when I click, and Chrome’s dev tools show only two click event listeners: document, and document

I have tried these as substitutes but nothing works. No alert message, no breakpoint hit, no registered click event listeners. …

$renderedItem.on('click', function(){
       alert("Hello.");
       alert($(this).jqmData('activityId'));     //'this' represents the element being clicked
   });

$renderedItem.live('click', function(){
       alert("Hello.");
       alert($(this).jqmData('activityId'));     //'this' represents the element being clicked
   });

I have also tried the standard Backbone way of registering events to no avail…

events: {
    'click .activity-list-item':'btnSelected'
},

...

btnSelected: function(){
    alert("Hello");
    //This is what I really want. Some data attached to the sender
    alert($(this).jqmData('activityId'));
}

This is template:

<li><a href="#activity-details" class="activity-list-item"identifier="<%= id %>"><%= date %> - <%= type %></a></li>

Thank you, ladies and gentlemen for your time.

EDIT: I have done a test and I think, for some reason, the bind is getting removed. I can do this:

    myCollection.at(0).bind('click', function(){
        alert("hello");
    });
    myCollection.at(0).trigger('click');

…and it works as it should. Is there a reason that the binds might be getting removed?

EDIT 2: This is still not solved. Unfortunately my temporary solution was exactly that. I can delete all listview items, repopulate, and refresh and still have clickability, but if I APPEND items to the list, they are not clickable. .bind, .on, .live, .delegate. None of them work. I really wish there was more documentation about this. This is a common programming problem with no common solution.

  • 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-05T14:45:40+00:00Added an answer on June 5, 2026 at 2:45 pm

    It looks like jquerymobile may be intercepting & unbinding your event bindings. This is still just a guess, since I’m not setup to test JQM apps right now, but it looks like there is a setting to turn off jqm’s default control of event bindings for links, linkBindingEnabled.

    You can set it like this:

    $(document).bind("mobileinit", function () {
      $.mobile.linkBindingEnabled = false;
    });
    

    Try that, see if it gets you anywhere… If not, back to the drawing board 🙂

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.