JQUERY
i have 4 buttons that are pulled from a database and appended to a list, but only this first appended button works. All the rest wont do anything.

```
function getaplist(){
 $.getJSON('/geticsassignments',
 function(data){
 console.log(data)
 for (var i = 0; i < data.length; i++){
  var assign = ("<tr><th><button class='btn btn-warning' id='getaptext' 
  value=''>"+ data[i].aparatus +"</button></th></tr>")
 $('#aptbody').append(assign)
}

$('#getaptext').on('click', function(){
 $("#getaptext").removeClass("btn btn-warning").addClass("btn btn-danger")
 var aparatus = $(this).text()
 alert(aparatus)
 $.getJSON('/sendap',{
 }, function(data){
  console.log(data)
 })
})
})
}
getaplist()

<div id='aplist'>
 <table class="table">
    <thead>
       <tr>
          <th><p style="text-align: center;">Aparatus</p></th>
       </tr>
    </thead>
    <tbody id='aptbody'>
    </tbody>
 </table>
  </div>

```