0

I've got a popup on page A which appends to (or creates, if it doesn't already exist) a listview on page B. After creating or appending to the listview, I call:

$('#summaryList').listview().listview('refresh');

In the listview on page B, there is an a within each li. The a opens up another popup. This is all working as expected. I'm trying to get an alert to fire when the a tag is clicked, but nothing seems to be working.

I've tried:

$(document).ready(function() {
    $('a.editBtn').click(function( event ) {
        alert("test");
    });
});

as well as

$("a.editBtn").on('pagecreate', function() {
    alert("test");
});

Any suggestions?

Brad
  • 1,019
  • 1
  • 9
  • 22
  • what is 'pagecreate' ? try putting 'click' instead of 'pagecreate' – Mandy Sep 09 '16 at 11:12
  • You're assigning the click event before the a.editBtn has been generated – freedomn-m Sep 09 '16 at 11:13
  • @freedomn-m, that link to [Event binding on dynamically created elements](http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements) worked perfectly! Thanks! – Brad Sep 11 '16 at 03:03

0 Answers0