Reputation: 571
I am using following code:
<s:submit type="input" value="clickme" onclick="func()"/>
and in func()
I have an alert("hereee") but when I click it, it shows "hereee" in an alert window. But it also refreshes the page as well. How to prevent page refresh onclick event?
Can anyone help?
Upvotes: 0
Views: 2220
Reputation: 9469
Use return false
to prevent the page refresh.
<s:submit type="input" value="clickme" onclick="func(); return false;"/>
Upvotes: 1