在我的javascript中将按钮更改为提交按钮
我在代码中遇到了一个重大错误,我忘记了按钮不能是PHP中的isset(),只能是提交按钮 我在表单中使用了“下一步”和“上一步”按钮,因此它们可以使用选中的单选按钮“下一步”和“上一步” 但在转到下一个单选按钮之前,我需要对表单进行验证,当我尝试将按钮转换为“提交”按钮时,它出现故障,无法转到下一个单选按钮 帮我转换这些按钮代码来提交和整理我的javascript,我已经试了一整天了,我想我又忘了什么 HTML在我的javascript中将按钮更改为提交按钮,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我在代码中遇到了一个重大错误,我忘记了按钮不能是PHP中的isset(),只能是提交按钮 我在表单中使用了“下一步”和“上一步”按钮,因此它们可以使用选中的单选按钮“下一步”和“上一步” 但在转到下一个单选按钮之前,我需要对表单进行验证,当我尝试将按钮转换为“提交”按钮时,它出现故障,无法转到下一个单选按钮 帮我转换这些按钮代码来提交和整理我的javascript,我已经试了一整天了,我想我又忘了什么 HTML <form action="reservation_next_samp
<form action="reservation_next_sample.php" method="POST">
<input type="radio" name="next[]" value="1" checked="checked">
<input type="radio" name="next[]" value="2" />
<div id="next1" class="desc">
<div class="div-details">
<h4>Event's Detail</h4>
<table>
<tr>
<td>
Street
</td>
<td>
<input type="text" name="event_street">
</td>
</tr>
<tr>
<td>
Barangay
</td>
<td>
<input type="text" name="event_brgy">
</td>
</tr>
<tr>
<td>
Town/City
</td>
<td>
<input type="text" name="event_town_city">
</td>
</tr>
<tr>
<td>
Province
</td>
<td>
<input type="text" name="event_province">
</td>
</tr>
</table>
<br>
<button type="button" onclick="dayNavigation('next');" data-role="none" class="slick-prev" aria-label="Next" tabindex="0" role="button">Next</button>
</div>
<div id="next2" class="desc" style="display: none;">
<p> inside of next 2 </p>
<button type="button" onclick="dayNavigation('prev');" data-role="none" class="slick-next" aria-label="Previous" tabindex="0" role="button">Previous</button>
<button type="button" onclick="dayNavigation('next');" data-role="none" class="slick-prev" aria-label="Next" tabindex="0" role="button">Next</button>
</div>
</form>
活动详情
街头
巴郎涯
城镇
省
下一个
下一个2的内部
以前的
下一个
JAVASCRIPT
<script>
$(document).ready(function() {
$("input[name$='next[]']").click(function() {
var test = $(this).val();
$("div.desc").hide();
$("#next" + test).show();
});
});
//this is in the bla bla next and previous -->
var index = 0;
dayNavigation = function(direction) {
var curr = $('input[name="next[]"]:checked');
if (direction == 'next') {
curr.next().attr("checked", "checked");
curr.next().click();
} else {
curr.prev().attr("checked", "checked");
curr.prev().click();
}
};
</script>
$(文档).ready(函数(){
$(“输入[name$='next[]']”)。单击(函数(){
var test=$(this.val();
$(“div.desc”).hide();
$(“#下一步”+测试).show();
});
});
//这在bla bla下一个和上一个-->
var指数=0;
dayNavigation=功能(方向){
var curr=$('input[name=“next[]”:checked');
如果(方向==“下一步”){
curr.next().attr(“选中”、“选中”);
当前下一步()。单击();
}否则{
curr.prev().attr(“checked”、“checked”);
当前版本()。单击();
}
};
您可以使用jQuery提交表单,下面给出了一个示例。不更改按钮以提交
$("button[type=button]").click(function(){
this.closest("form").submit();
})
请给出按钮id并选择特定的按钮$(“#按钮id=button”),而不是选择类似按钮$(“#按钮id=button”)。你想要达到的目标是什么?我看到的只是隐藏和显示div元素的按钮。这与PHP
isset()
有什么关系?为什么要检查它们?将type=“button”
更改为type=“submit”
?现在还不清楚什么是问题,什么不起作用。是的,就是它!很抱歉,我的声明不清楚。当我试图将“下一步”和“上一步”按钮更改为“提交”按钮时,“下一步”和“上一步”按钮不起作用……@ZeuneeLo:Define“not working”。这里具体发生了什么?你到底在提交什么?我在代码中没有看到表单。如果你想让你的按钮成为“提交”按钮,为什么要将它们改为“提交”按钮“不起作用”?我编辑了我的帖子,这个问题已经发布了……不幸的是,当我使用它时,它也会出现同样的问题:(