1. 程式人生 > >【s:checkboxlist】JS中取s:checkboxlist選中的value傳入後臺例項

【s:checkboxlist】JS中取s:checkboxlist選中的value傳入後臺例項

body中:

<td width="35%">
      <s:checkboxlist name="cc" id="kscc1" list="#{'AM':'上午','PM':'下午' }" value="" cssStyle="width:20px;"/>
        </td>

js方法:

jQuery("input[name='cc']").each(function(){
if($(this).attr("checked")){ 
kscc += this.value + ",";
}
});

傳到後臺用split取出選中值。回顯參照下面的連結