javascript - jQuery click handlers not triggered inside a modal window -


i have simple click handler makes ajax get request on click so:

$('span.switch-option').click(function() {     $(this).parents('div.log-in-option').hide();     $(this).parents('div.log-in-option').siblings('div.log-in-option').fadein(); }); 

this works anywhere else on website. however, when try click <span> element class switch-option inside modal window, event not fire. entering contents of click-handler function in console , running them perform desired behavior, however.

why click handler not fire in modal window? using popular simplemodal plugin http://www.ericmmartin.com/projects/simplemodal/ , jquery 1.9.1.

a live example here: http://ec2-107-22-8-70.compute-1.amazonaws.com/thread/19. if click 50,000 reps or user's reputation try click big blue link in dialog, click handler not fire. behavior happens other click handlers in different modal windows well.

when script(main.js) running elements 'li.log-in, a.log-in' not exists in dom, loaded dynamically when popup created jquery not able bind event handlers

try event propagation

$(document).on('click', 'li.log-in, a.log-in', function() {         $.get('/login/', function(data) {             //make modal window html             $.modal(data);         });         return false;     }); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -