Hello, everyone.
I'm dynamically populating a div after the page loads with some anchor tags. Basically, click one or more names in a multi-select and the names are added with anchor tags around them so that they can be removed by clicking the name.
I would like to set it so that when each name is clicked, if an alert message in a particular div is blank, then the div will display "Changes to this record have not been saved."
I'm not getting the function right. I've tried several different ways, I'll include two of them below.
These are all coded within the $(document).ready()
Code:
$('.remLink a').each(function(e){
e.preventDefault();
$(this).click(function(){
$('#chgWarning').html("Changes to this record have not been saved");
});
});
Code:
$('.remLink a').each(function(e){
e.preventDefault();
$(this).live('click',function(){
$('#chgWarning').html("Changes to this record have not been saved");
});
});
How does one apply an event to an anchor that doesn't exist when the page loads?
Thank you,