0
當表列selection
的值不是none
時,我需要隱藏所有按鈕。然後如何在PHP代碼中使用javascript或jquery禁用按鈕。歡迎提出建議,使用JavaScript代碼或jQuery中的php代碼來完成此任務。我的按鈕列表如下。如何在PHP代碼中使用javascript或jquery禁用按鈕
<?php include("db_conection.php");$sql = "SELECT selection FROM users";
$result = $dbcon->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$value = $row['selection'];
if($value !='none'){
//need to add jquery or javascript here
//$('button').attr("disabled", "disabled");
//$('button').text('Disabled');
}
}
}?>
<script type="text/javascript" >
// $('button').attr("disabled", "disabled");
// $('button').text('Disabled');
< /script>
<tr>
<td>
<button type="button" class="btn btn-primary" id="q1-1">Q1-1</button >
< /td>
<td>
<button type="button" class="btn btn-primary" id="q2-1">Q2-1</button >
< /td>
<td>
<button type="button" class="btn btn-primary" id="q3-1">Q3-1</button >
< /td>
<td>
<button type="button" class="btn btn-primary" id="q4-1">Q4-1</button >
< /td>
</tr >