I have a form and once it gets submitted successfully , then after the roundtrip from the server I get a success message displayed on the same page.
I am using the following code:
<s:if test="%{#session.str==1}" >
<div onload="showSuccessToast();">
<button onclick="showSuccessToast();"></button>
</div>
</s:if>
Now when I return from the server (form submit successful) then the button is displayed and on its onClick
event the showSuccessToast()
is called but when I expect div to call this function on the onload
event it has no effect.
Any idea how to achieve this.
Modify it as follows which is kind of simulating "on-load-div":
<s:if test="%{#session.str==1}" >
<div>
<button onclick="showSuccessToast();"></button>
<script language="javascript" type="text/javascript">
showSuccessToast();
</script>
</div>
</s:if>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.