Wondering why the example below doesn\'t work?
Load the list
.live is deprecated as of 1.7. Try this (jquery 2.1.4):
Html:
Load the list
JQuery:
$(document).ready(function() {
$('#load_list').click(function() {
$('ul').html("");
$("", {
"class" : "someClass",
text: "Click here",
click: function() {
alert($(this).text());
}
}).appendTo('ul');
});
});
or something like this (but I didn't find how to attach click to the anchor):
$(document).ready(function() {
$('#load_list').click(function() {
$('ul').html("");
$('- Click here
').on({
click: function() {
alert("hoi");
}
}).appendTo("ul");
});
});