weixin_33681778 2014-07-21 17:11 采纳率: 0%
浏览 28


I am trying to submit a variable on form1 using jquery which at the end disables the submit button for this form with a message "Sent Successfully".

There's another form on the page called form2 which is assigned an action to submit variables to another page without ajax call but i think my button disable code is conflicting with the form2 not making it able to send the variables to the assigned action page.

<script language="javascript">
 * Disable submit button
      $('input:submit', '#form1').click(function(){
            $(this).val('Sent Successfully...');
            $(this).attr('disabled', 'disabled');


<form id="form2" name="form2" method="post" action="search.php">
          <label for="textfield"></label>
          <input type="text" name="textfield" id="textfield" />
          <input type="submit" name="button2" id="button2" value="Submit" />
  • 写回答

4条回答 默认 最新

  • weixin_33724046 2014-07-21 17:13

    yes it deflects because you're using two selectors, one that will disable all the submit buttons and then #form1. try changing it to:

                $(this).val('Sent Successfully...');
                $(this).attr('disabled', 'disabled');



  • ¥15 R语言爬虫的时候元素和园代码不一样怎么解决呀
  • ¥15 VS2022多项目启动有问题
  • ¥15 SQL删除添加数据后序号不连续问题。
  • ¥15 首次运行OmniEvent运行报错
  • ¥15 有没有人知道这个问题怎么解决
  • ¥15 comsol电力电缆载流量仿真
  • ¥15 webSocket可以接TCP socket接口吗
  • ¥60 mpi并行出错,CFD++计算
  • ¥15 c#:vsto,powerpoint的外接程序中换主题颜色
  • ¥15 状态机/汽车转向灯/Sateflow