gpt4 book ai didi

JavaScript CSV 验证

转载 作者:太空宇宙 更新时间:2023-11-04 15:25:49 26 4
gpt4 key购买 nike

如何检查文本框中的逗号分隔值并在未找到时发出警报?如果有的话,里面应该有像 A,B,C,D

这样的字符
  function validate()
{
//validate text box;
}
<input type="text" id="val" >A,B,C,D</input>
<input type="button" id="save" onclick="validate()">

最佳答案

/^[A-Za-z](?:,[A-Za-z])*$/.test(document.getElementById("val").value)

关于JavaScript CSV 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2513642/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com