How to use struts2 submit tag as button without submitting the form?

前端 未结 2 1506
再見小時候
再見小時候 2020-12-09 21:22

I am using Struts2 framework in my application, I have one button on my JSP page. That is


相关标签:
2条回答
  • 2020-12-09 21:33

    Have you tried preventDefault()?

    $("btnSave").click(function(e){
        e.preventDefault();   
        //..rest of the code
    });
    
    0 讨论(0)
  • 2020-12-09 21:46

    If you are using s:submit tag the rendered HTML output is either input or button tag but the type is submit except for the image type. You can use the code to execute javascript onclick event that doesn't submit the form.

    <s:submit type="button" onclick="return false;"/>
    
    0 讨论(0)
提交回复
热议问题