是否可以使用javascript在我的確認框上觸發按鈕類型"submit"
?我想觸發我的"OK"
選項上的提交按鈕。我想刪除我的HTML表單中的<button type = "submit" class = "btn btn-primary">Okay!</button>
。我只是想在"OK"
選項下觸發它,這是可能的嗎?如何使用javascript確認框設置提交按鈕?
的Javascript
<script>
function showApprove()
{
value = confirm("Approve this document?");
if (value == true)
{
// I WANTED TO TRIGGER HERE :)
}
else
{
}
}
function showReject()
{
value = confirm("Reject this document?");
if (value == true)
{
}
else
{
}
}
</script>
查看
<input type="hidden" name = "id" value = "{{$list->id}}">
<div class = "radio">
<label><input type = "radio" onclick = "showApprove()" name = "status" id = "approve" value="1"> Approve</label>
</div>
<div class = "radio">
<label><input type = "radio" onclick = "showReject()" name = "status" id = "reject" value="0"> Reject</label>
</div>
<button type = "submit" class = "btn btn-primary">Okay!</button>
<input type = "hidden" name = "_token" value = "{{ Session::token() }}">
所以我的視圖看起來像有在我的HTML是沒有按鈕了。我只是想在我的確認框中觸發這個。
這是什麼問題...你的代碼看起來不錯,我認爲它會工作..請解釋你想要的問題輸出 – rahul