我有一個PHP while循環,我正在動態生成#id。在jquery腳本的頁面加載時獲取ID
例子:
<?php
$i=1;
while ($row = mysqli_fetch_array($result)):
?>
<tr>
<td class='hashtag' id='status<?php echo $i; ?>'>status value</td>
</tr>
<?php
$i++;
endwhile:
?>
狀態ID都產生這樣的:狀態1,狀態2,STATUS3等等
我想在我的JS代碼在加載所有這些標識的用於顯示入模態對話框。
例子:
<script type="text/javascript">
$(document).ready(function(){
$("#status1");
$("#status2");
$("#status3");
.
.
and so on as per the php while loop.
});
</script>
我怎樣才能做到這一點?
爲什麼不使用'$你叫他們在模板(」#標籤。 ').each()'函數? – arulmr
mysqli? PDO ftw! – elclanrs