Currently, I am using an image button in JSP to trigger a JavaScript function upon click. The code snippet I have is as follows:
<img src="<%= imagesDir%>/bt_pre.gif" onclick="return PreviousQ();" id="prevbtn" style="cursor: hand;">
The above code works perfectly fine. However, when I tried to update it using the button tag, the onclick function does not seem to get called successfully.
<button class="css-button-rounded" onclick="return PreviousQ();" id="prevbtn" style="cursor: hand;">Back question</button>
I'm wondering how can I achieve the same functionality of calling onclick="return PreviousQ();" and id="prevbtn" with the button element?
Thank you very much!