Hey i'm trying to make use of onclick =return confirm but whenever I click on the button, no prompt appears and it just heads to the redirect. My front end development isn't really the best. Any help is appreciated. Thanks
<td><a href="delete.php?id='.$row["userID"].'" onclick="return confirm("Are you sure you want to delete ?")" class="waves-effect waves-light btn-small red lighten-1"><i class="material-icons">delete</i></a></td>
CodePudding user response:
You can try this which works for me :
echo "<td><a onClick=\"javascript: return confirm('Are You sure to delete this');\" href='delete.php?id=".$res['id']."'>Delete</a></td>";
CodePudding user response:
If you don't surround an attribute value with quotes, then the value ends at the first space.
You have:
onlick=return
Your second problem is that you forgot the c
Using the Inspector feature in your browser to see what attribute is actually generated is a useful debugging technique that would have helped you narrow down the problem here.