通过单击CSS按钮提交/检测提交表单

时间:2022-11-24 08:41:07

I am experiencing a issue detecting if the submit button was clicked. I was give the following form by a CSS designer:

我在检测是否单击了提交按钮时遇到问题。我是由CSS设计师提供以下表格:

<form action="" method="post">
    <div class="form-group">
        <label>Username</label>
        <input name="username" type="text" class="form-control span12">
    </div>
    <div class="form-group">
        <label>Password</label>
        <input name="password" type="password" class="form-controlspan12 form-control">
    </div> 
    <a href="" class="btn btn-primary pull-right">Sign In</a>    
    <div class="clearfix"></div>
</form>

I would like submit the captured information by clicking on the Sign In CSS button. I am used to the usual:

我想通过单击登录CSS按钮提交捕获的信息。我习惯了平时:

<input type="Submit" value="Sign-In>

button, but not this is different, I am stuck. Any assistance will be appreciated.

按钮,但不是这个不同,我卡住了。任何帮助将不胜感激。

2 个解决方案

#1


2  

try to change

试着改变

<a href="" class="btn btn-primary pull-right">Sign In</a>

with

<button type="submit" class="btn btn-primary pull-right">Sign In</button>

Furthermore you need to set an action attribute on your form element

此外,您需要在表单元素上设置action属性

#2


0  

Give your form and ID = "myform" And try below:

提供您的表单和ID =“myform”并尝试以下内容:

<a href="javascript:void(0);" onClick="document.forms['myform'].submit();" class="btn btn-primary pull-right">Sign In</a>

#1


2  

try to change

试着改变

<a href="" class="btn btn-primary pull-right">Sign In</a>

with

<button type="submit" class="btn btn-primary pull-right">Sign In</button>

Furthermore you need to set an action attribute on your form element

此外,您需要在表单元素上设置action属性

#2


0  

Give your form and ID = "myform" And try below:

提供您的表单和ID =“myform”并尝试以下内容:

<a href="javascript:void(0);" onClick="document.forms['myform'].submit();" class="btn btn-primary pull-right">Sign In</a>