开发者

How to submit info from 2 submit button but from one button through jquery?

开发者 https://www.devze.com 2022-12-20 12:09 出处:网络
I have 2 SUBMIT button in a form one is display:hidden and one is display:block if user click on SUBMIT button (display:block) then another SUBMIT button {display:hidden} should also submitte开发者_S

I have 2 SUBMIT button in a form one is display:hidden and one is display:block

if user click on SUBMIT button (display:block) then another SUBMIT button {display:hidden} should also submitte开发者_StackOverflow社区d.

Is it possible with jquery?


You can trigger the other button click using trigger. Something like

$("#btn1").click(function(){
    // event handler for button 1
    $("#btn2").trigger("click"); // trigger button 2 click event handler
});

$("#btn2").click(function(){
    // event handler for button 2
});


That does not make sense: either you need 2 actions to be formed, and so, you solve it through your serverside processing script, or you need that second button value, in such case you use it as "hidden" input field <input type="hidden" name="foo" value="bar"/>

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号