我有两个像这样的单选按钮
<input type="radio" name="rush" value="yes" />
<input type="radio" name="rush" value="no" checked="checked" />
我想要做的是单击表单提交按钮时,检查是否选择了“是”。
如果是,显示一个 javascript 确认对话框
我已经走了这么远,但被卡住了,任何帮助将不胜感激。
$("form.shipping").submit(function() {
if($("input[name='rush']".attr("value") === "yes")
{
if (confirm("Rush orders are subject to an upcharge. (Just wanted to make sure you read the note). Is this ok?"))
{
return true;
}
else
{
return false;
}
}
});