I have a click listener set to listen to p a
but it's only works once and then no more. I know it's not the code that's running from the click that's the problem because if I run it from the console it runs fine, it's the actual listener that doesn't work.
Listener:
$('p a').click(function() {
var v = $('p a').prev('input').val();
$('p a').parent('p').after('<p><input type="text"> <a href="#">Add More</a></p>');
$('p a').first().parent('p').html('<input type="text" value="' + v + '">');
});
Could someone please explain to me why this only runs once?