I have an element with some id, I changed its ID
and when I click on that element (with new ID
now), it still calls the function with previous ID
$('#1st').click(function(){
$('#1st').attr('id','2nd');
alert("id changed to 2nd");
});
$('#2nd').click(function(){
alert("clicked on second");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<a href="javascript:;" id="1st">Click</a>
Example is here