我想在while循環中使用jQuery Dropdown CheckList。但只在第一行顯示jQuery Dropdown Checklist。對於該行的其餘部分,它沒有調用jQuery Dropdown Checklist函數。有沒有辦法讓我動態調用jQuery函數。while循環中的jQuery下拉清單
//This is the java script for calling the dropdown list
<meta http-equiv="refresh" content="600" >
<!-- Apply dropdown check list to the selected items -->
<script type="text/javascript">
$(document).ready(function(){$("#s1").dropdownchecklist({ width: 300 });});
</script>
//this is the while loop which display the list of row with drop down checklist in it
//display the list of rows
while($rows = mysql_fetch_array($query)){
<select id="s1" multiple="multiple" >
<option value=""></option>
<?php while($rowsakh= mysql_fetch_array($resultakh)) { ?>
<option value='<?php echo $rowsakh['diet_id']; ?>'><?php echo $rowsakh['diet_name']; ?></option> <?php } ?>
</select>
}//end while loop
如果我試着讓id="s1"
是一個動態的變量,其中它增加了每個循環。有沒有什麼辦法可以動態地創建id="s1"
或者我的語法如何。
你的'$ query'是什麼? – yvonnezoe