Basically I've created a overlay and load this into appendTo as a 'loading screen'.
Recently, I needed to add a Stop button to the overlay which isn't a problem, however the jquery .click function isn't picking up the button click, I've tried keeping the existing button and therefore it would maybe register, but sadly hasn't.
(I've also tried using an Id for the button too.
Below is some test code to demonstrate the problem.
$(document).ready(function(){
$("#addButton").click( function () {
$overlay = $("<div id='overlay'><div id='contain'><h3 style='color:#FFF'>Processing, just a moment</h3> <div id='stop'><button type='button' class='btn btn-primary' id='stop1' >Stop</button></div><div class='bar' style='width: 80%; padding-top:50%'></div></div></div");
$overlay.appendTo(document.body);
$("#stop").click( function() {
alert("working");
});
});
Edit:
Just to clarify, this is what I originally wanted, however due to 'over changes' the above example will work in my scenario, this is the original problem just for clarity.
$(document).ready(function(){
$("#addButton").click( function () {
$overlay = $("<div id='overlay'><div id='contain'><h3 style='color:#FFF'>Processing, just a moment</h3> <div id='stop'><button type='button' class='btn btn-primary' id='stop1' >Stop</button></div><div class='bar' style='width: 80%; padding-top:50%'></div></div></div");
$overlay.appendTo(document.body);
});
$("#stop").click( function() {
alert("working");
});
});