I'm having an issue with ajax generated selectors.
basically i have a start button in default state.
onclick, it starts something, and then the click also brings in a new div from an ajax call with results. one of these items is the stop button.
my linked script from the main page has a click event attached to this stop button
<a id="stop">stop</a>
$('#stop').click(function() { });
If
<div id="container"></div>
is the element which you're appending the results of the ajax
call to,
You want to do:
$('#container').on('click', '#stop', function() { console.log('test'); });
Alternatively you could do something like
$('#stop').live('click', function(){ console.log('test'); });
But I wouldn't recommend that if you are going to have a lot of events on the page to handle, because live
adds overhead every time it's used.