How to Disable button using javascript or jquery inside PHP code -
i need invisible buttons when table column selection
value not none
. how disable button using javascript or jquery inside php code. suggestions welcome task using php code inside javascript or jquery.i have buttons list follows.
<?php include("db_conection.php");$sql = "select selection users"; $result = $dbcon->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $value = $row['selection']; if($value !='none'){ //need 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 >
try pass value first in text element:
<input type"text" id="samplevalue" value="<?php echo($value)> // put value in text element.
after that, use in jquery id.
<script type="text/javascript" > if($('#samplevalue')!='none') { $('button').attr("disabled", "disabled"); $('button').text('disabled'); } </script>
Comments
Post a Comment