我有SELECT字段的HTML表单,当我选择选项时,我想启动CONFIRM消息,如果我选择"是"它应该提交表格。
我该怎么做?
<form action="index.php?page=<?PHP echo $_GET['page'] ?>" method="post" >
<select name="planID" onChange="this.form.submit()" class="form-control">
<option value="">Choose plan1</option>
<option value="">Choose plan2</option>
<option value="">Choose plan3</option>
</select>
</form>
答案 0 :(得分:0)
HTML:
<form action="index.php?page=<?PHP echo $_GET['page'] ?>" method="post" id="myForm">
<select name="planID" onchange="if(confirm('Are you sure?')) document.getElementById('myForm').submit();" class="form-control">
<option value="">Choose plan1</option>
<option value="">Choose plan2</option>
<option value="">Choose plan3</option>
</select>
</form>