0
我想要做的是,单击保存按钮时,如果用户选择了任何缺少单选按钮但未选择下拉选项,则需要显示一条警报消息。单选按钮和下拉验证
我试过2种方法。首先是这样
if ($(".missing input[type:radio]:checked").length > 0 && $(".reason").val() == "")
{
alert("You have not selected a reason from the drop down list of the Missing section.");
return false;
}
第二种方法 - 通过识别textarea中的文本。如果它包含〜CM ~~然后显示一个提醒
if ("ta:contains(~CM~~).length>0")
{
alert("Missing radio has been selected but nothing in the drop down has been selected");
}
我已经注意到在小提琴中的代码,并感觉使用任何方法。
谢谢。不幸的是,我无法向tr添加任何内容。你能否告诉我为什么我的第二个代码(:contains)不起作用。它的目的是检查textarea是否有〜CM ~~如果它有警报。 – 19eggs
我不完全是为什么,但类似的方法是这样的:'if(ta.indexOf(“〜CM ~~”)> 0)' –