首页 \ 问答 \ 我的JQuery验证错误(Error in my JQuery validation)

我的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"
  • 我为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 ...
  • 我能够用调试器在我的测试机器上运行它,并找到我的问题所在。 它实际上与通过命令提示符传递的参数无关。 这是另一个我打的子电话。 我将不得不使用它,如果我不能弄明白,我会打开另一个问题。 感谢您的帮助。 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 ..." 这只会在启动时运行一次。 如果要在每次登录时运行,则需要将其更改为: ...
  • 如果没有提升启动processNeedToRun的进程,则无法避免提升对话框 。 这样做会是一个安全漏洞。 因此,您将不得不忍受提升提示。 但是,向processNeedToRun添加参数没有问题。 您可以将它们添加到传递给ProcessStartInfo的参数中: var procStartInfo = new ProcessStartInfo("cmd", "/c processNeedToRun arg1 arg2"); If the process that's launching process ...
  • 很抱歉发布此答案,但我还不能发表评论。 我想也许你可能有一个调用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.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。