I have two click functions in a file,
$('#login').click(function() {
// something
// also adding the logout part
$('#navigation').append('<li id="logout"><a href="#" >Logout</a></li>');
});
$('#logout').click(function() {
// something
});
When I load the page first time, do a login and then directly do logout, the $('#logout').click() doesn't work. Now if I do a page refresh then it starts working. Is this not the correct way to provide click functions. Or is it that, as the #logout is not created at the beginning the $('#logout').click() is not loaded?