jQuery live() ... have to click twice to activate links?
- by neezer
I have the following bit of code, simply:
$(function() {
$('a.add-photos-link').live('click', function(e) {
$(this).colorbox({
overlayClose: false,
onComplete: function() {
$('#add_photos').submit(function(e) {
// more stuff to do
e.preventDefault();
});
}
});
e.preventDefault();
});
});
However, this only seems to work after single-clicking on the link TWICE. These links are dynamically added to the page (a.add-photos-link).
Why is this happening and what can I do to fix it so it fires after the first single-click?