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 >