This is my buttons:
this is my JavaScript cod
It's because you've removed the id which is how you're finding the element. This line of code is trying to add id="page_navigation1" to an element with the id named page_navigation1, but it doesn't exist (because you deleted the attribute):
$("#page_navigation1").attr("id","page_navigation1");
Demo:
If you want to add and remove a class that makes your And: Where $( '#page_navigation1' ).addClass( 'red-class' );
$( '#page_navigation1' ).removeClass( 'red-class' );
red-class is:.red-class {
background-color: red;
}