[英]validation on dropdown in javascript
i have dropdown named po_no with same id which is coming from ajax file 我有一个名为po_no的下拉列表,具有来自ajax文件的相同ID
in po_no getting two values in the format of 1025*3 在po_no中获取两个格式为1025 * 3的值
when i put validation on that dropdown in javascript i write this code 当我在javascript上的该下拉列表上进行验证时,我编写此代码
if(document.getElementById('po_no').value=="")
{
alert("Choose Purchase Order Number");
return false;
}
but this code does not work plz give me ideas 但是这段代码不起作用请给我一些想法
Does your JavaScript run after "po_no" is added to the DOM? 在将 “ po_no”添加到DOM 后,您的JavaScript是否运行? If it runs before, then "document.getElementById('po_no')" will return null.
如果之前运行过,则“ document.getElementById('po_no')”将返回null。
try these 试试这些
var selObj = document.getElementById('selSeaShells');
if(selObj.options[selIndex].value=="") { alert("sadAS"); if(selObj.options [selIndex] .value ==“”){alert(“ sadAS”); }
}
REFER 参考
http://www.mredkj.com/tutorials/tutorial002.html http://www.mredkj.com/tutorials/tutorial002.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.