I am retrieving data from a remote server via JSON and attaching a button to it:
$.getJSON('http://www.mysite.com/jsond1.php',
function(data){
jsonObject=eval(data);
day1content = jsonObject.json1;
//APPEND TO DIV
$('#showday1').append(day1content);
//CREATE BUTTON, ADD VALUE FROM
var input = '<input type="button" class="save_event" value="Save to My Program" />';
//ATTACH BUTTON
$('.event').append(input);
This works fine. But I want to attach an event to the button, ie:
$('.save_event').click(function() {
console.log("HERE");
});
and when I place this directly below the script above nothing happens. Would anyone know why this is occuring? Do I need to to something special with JQuery Mobile?