I have a select which runs an AJAX function. This function returns a form with a button. Now I'd like to assign a function to this button with jQuery's .click() (or .on()).
E.g.
<select id='test'>
    <option val='1'>...</option>
    ...
</select>
/* Empty and filled with AJAX call */
<div id="ajax">
     /* FOLLOWING THE CONTENT RETURNED BY THE AJAX CALL */
     /* Won't work (see script below) */
     <input type="button" id="button" value="button" />
     /* will work */
     <input type="button" value="button" onclick="clickMe()" />
</div>
JavaScript
$('#test').change(function(){
    $.ajax({
        ...
});
$('#button').click(function(){
    /* DOESN'T WORK */
    alert('click')
});
function clickMe(){
    /* WORKS */
    alert('click')
};
Is there a way to "enable" the AJAX result?
 
     
     
     
    