I am clicking a submit button using this:
我使用以下命令单击提交按钮:
Hlml :
<button type="submit" class="btn btn-submit">Submit</button>
Js :
$("#form_id").on('submit',(function(e) {
The problem is that I have more that 1 submit button on my form wizard so I need to target a specific submit button.
问题是我的表单向导上有更多1提交按钮,所以我需要定位一个特定的提交按钮。
LIke
<button type="submit" id="submit_form" class="btn btn-submit">Submit</button>
How could I submit form using id="submit_form
and $("#form_id")
?
我怎么能用id =“submit_form和$(”#form_id“)提交表单?
1 个解决方案
#1
1
You could attach click event to the button you want using the specific id attribute :
您可以使用特定的id属性将click事件附加到您想要的按钮:
$("#form_id").on('click', '#submit_form', function(e) {
e.preventDefault();
//You logic here
//Submit form at the end if you want
//$("#form_id").submit();
});
Hope this helps.
希望这可以帮助。
#1
1
You could attach click event to the button you want using the specific id attribute :
您可以使用特定的id属性将click事件附加到您想要的按钮:
$("#form_id").on('click', '#submit_form', function(e) {
e.preventDefault();
//You logic here
//Submit form at the end if you want
//$("#form_id").submit();
});
Hope this helps.
希望这可以帮助。