JSFiddle - React, Tailwind, and code Playground

HTML

<input name="delButton<{$student.houseId}>" id="delButton<{$student.houseId}>" class="button" type="button" value="刪除" onclick="if(confirm('確定要刪除?')){if(getValue()){xajax_DeleStudent('<{$student.houseId}>','$aa','<{$smarty.session.school_id}>');return false;}}" />

<td style="text-align: center"><input type="checkbox"  name="checked[]" group="1" value="<{$student.resident_sid}>" /></td>
                        
<{$("#txt").attr("value",txt);}>

JavaScript

$(document).ready(function() {  

var cbxVehicle = new Array();
    
    $("#clickAll").click(function() {
      txt = "";
     $('input:checkbox:checked[id="checkbox"]').each(function(i) { cbxVehicle[i] = this.value; });
       
       txt = cbxVehicle.join(",");
    //txt = "123";
       
       $("#txt").attr("value",txt);
        
    });
    
});