我的JQuery验证错误(Error in my JQuery validation)
你好,我在我的jquery验证错误,代码不做任何事,任何人都可以帮助我吗?
<script> // When the user submits the form, // Check what answer they picked // And tell them if they're correct // submit $("#form").on("submit", function(event) { event.preventDefault(); var $answer = $("#unit_name"); var answer = $answer.val(); console.log(answer); if (answer === "") { $("#result").text("Preencha corretamente o nome da unidade."); } else if(answer.length < 3 ) { $("#result").text("O nome da unidade é demasiado pequeno."); } }); </script>
这是实施表单的代码
<div class="pure-u-1"> <h3 align="center">Insert</h3> </div> <div class="form-group"> <label class="control-label" for="unit_name"Name concept:</label> <div class="input-group"> <input class="form-control" placeholder="Insert name" id="unit_name" name="unit_name" type="text" /> </div> </div> <input type="hidden" name="state" value="insert"> <input type="submit" value="Insert"> <br><br> </div> </form>
这个div将向用户显示消息。
Hello i have error in my Jquery validation, the code dont do nothing, can anybody help me?
<script> // When the user submits the form, // Check what answer they picked // And tell them if they're correct // submit $("#form").on("submit", function(event) { event.preventDefault(); var $answer = $("#unit_name"); var answer = $answer.val(); console.log(answer); if (answer === "") { $("#result").text("Preencha corretamente o nome da unidade."); } else if(answer.length < 3 ) { $("#result").text("O nome da unidade é demasiado pequeno."); } }); </script>
This is the code of the form implemented
<div class="pure-u-1"> <h3 align="center">Insert</h3> </div> <div class="form-group"> <label class="control-label" for="unit_name"Name concept:</label> <div class="input-group"> <input class="form-control" placeholder="Insert name" id="unit_name" name="unit_name" type="text" /> </div> </div> <input type="hidden" name="state" value="insert"> <input type="submit" value="Insert"> <br><br> </div> </form>
This div will show message to the users.
原文:https://stackoverflow.com/questions/41681460
更新时间:2022-10-08 08:10
最满意答案
您的示例对
*.reg
文件的行顺序错误。 以下应该有效:Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] "Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..."
这只会在启动时运行一次。 如果要在每次登录时运行,则需要将其更改为:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..."
Your example has the lines in the wrong order for a
*.reg
file. The following should work:Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] "Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..."
This will only run once on bootup. If you want to run every time you log in, then you need to change it to:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..."
相关问答
更多-
不是MSYS的专家,但做这样的工作适合你: rem Call this something like compile-project.bat c: cd \src\project bash -c "make" Not an MSYS expert, but does something like this work for you: rem Call this something like compile-project.bat c: cd \src\project bash -c "make"
-
替代Windows cmd(Substitute windows cmd)[2022-05-22]
我为Powershell提供了答案,应该与您想要使用的任何其他类似 : 使用Regedit和goto HKEY_CLASSES_ROOT\batfile\shell\open\command 将默认值设置为 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit "%1" %* 现在,当你双击任何批处理文件时,它应该运行在powershell上。 -noexit在完成批处理文件后进入-noexit提示。 I am giving a ... -
你不想在Linux上运行.bat文件,如果你真的想这样做,你可以在Linux上使用WINE。 CMD语言没有很多编程结构,很少用于做任何复杂的事情,它们非常专用,主要用于在Windows上启动其他程序。 有一种相对简单的方法来将bash脚本包装到.bat中。 @setlocal @cd C:\cygwin\bin @start bash --login -i /home/your_id/yourscript @endlocal You don't want to run .bat files on lin ...
-
通过Cmd传递参数时的NullArgumentException(NullArgumentException when Passing Arguments through Cmd)[2022-01-25]
我能够用调试器在我的测试机器上运行它,并找到我的问题所在。 它实际上与通过命令提示符传递的参数无关。 这是另一个我打的子电话。 我将不得不使用它,如果我不能弄明白,我会打开另一个问题。 感谢您的帮助。 I was able to run this on my testing machine with a debugger and found where my issue is. It actually has nothing to do with the arguments being passed by ... -
您的示例对*.reg文件的行顺序错误。 以下应该有效: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] "Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..." 这只会在启动时运行一次。 如果要在每次登录时运行,则需要将其更改为: ...
-
C#如何通过管理员提升的cmd运行进程(带参数)(C# how to run a process(with arguments) through an administrator elevated cmd)[2024-01-25]
如果没有提升启动processNeedToRun的进程,则无法避免提升对话框 。 这样做会是一个安全漏洞。 因此,您将不得不忍受提升提示。 但是,向processNeedToRun添加参数没有问题。 您可以将它们添加到传递给ProcessStartInfo的参数中: var procStartInfo = new ProcessStartInfo("cmd", "/c processNeedToRun arg1 arg2"); If the process that's launching process ... -
如何在bash for windows 10中运行.bat或.cmd文件(how to run .bat or .cmd files in bash for windows 10)[2022-05-19]
很抱歉发布此答案,但我还不能发表评论。 我想也许你可能有一个调用bash脚本的批处理文件,然后一旦它们退出,它就会开始播放文件,然后启动更多的bash脚本? 你也可以拆分你的代码......只是一个想法。 Sorry to post this as an answer but I cannot yet comment. I was thinking that maybe you could have a batch file that calls bash scripts, then once they e ... -
Python字符串是Unicode,但是您写入的管道仅支持字节。 尝试: cmdprocess.stdin.write(("mklink " + linkname + " " + fullname + "\r\n").encode("utf-8")) Python strings are Unicode, but the pipe you're writing to only supports bytes. Try: cmdprocess.stdin.write(("mklink " + linkname ...
-
所以,我的最后一种方法只是链接一个VBS文件(就像在评论中提到的那样。)事实证明我做错了,混合文件类型,所以我有奇怪的错误。 该VBS文件以静默方式调用BAT文件,因此cmd窗口未显示。 那个BAT文件然后调用我的程序,由于某种原因,从cmd调用时比在现场执行时更好。 现在,它确实在启动时运行,并且cmd窗口没有出现,所以这是一个很好的修复,虽然效率低下。 So, my final approach was just to link a VBS file (like it was mentioned in ...
-
您可以在sikuli脚本的开头给出wait(300)命令来实现此目的。 You can give wait(300) command at the beginning in your sikuli script to achieve this.