Issue
var x = <?php echo $row['type'];?>;
if (x=="canceled") {
document.getElementById("3").selected = "true";
}else if (x=="pending") {
document.getElementById("1").selected = "true";
}else if (x=="succeed") {
document.getElementById("2").selected = "true";
}else{
}
<th><select id="select">
<option value="1" id="1">Pending</option>
<option value="2" id ="2">Succeed</option>
<option value="3" id="3">Canceled</option>
</select></th>
When I run above code.. I get the error Uncaught ReferenceError: canceled is not defined at deposit_list.php:40
. In 40 no. line it is indicating <option value="2" id ="2">Succeed</option>
. I am unable to understand why this is happening?
Solution
Try use "
var x = "<?php echo $row['type'];?>";
Answered By - John V
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.