countguo

默认写在form表单里的按钮可以自动提交表单,现在要实现的效果是点击button按钮调用js函数,再有ajax提交

<button type="button" class="btn btn-sub" onclick="return formSubmit();">提交</button>

 

function formSubmit()
    {
        // 如果是修改渠道号,原来就有渠道参数,需要将原有的渠道参数初始化进去
        $("#attrTbody").children().each(function(){
            selChannelAttr.push({"name":$(this).children().eq(0).attr("name"), "value":$(this).children().eq(1).text(), "text":$(this).children().eq(0).text()});
        });

        $("#channelForm").submit();

        return false;
    }

代码如上,按如下说明改即可

在formSubmit()函数的最后加上 return false;

在HTML事件中 onclick="return formSubmit()"

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
猜你喜欢
  • 2021-12-08
  • 2022-12-23
  • 2021-07-22
  • 2022-03-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案