久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 jQuery 驗證插件:onfocusout、onkeyup 在生產站點

Using jQuery validate plugin: onfocusout, onkeyup notworking as expected on production site(使用 jQuery 驗證插件:onfocusout、onkeyup 在生產站點上未按預期工作)
本文介紹了使用 jQuery 驗證插件:onfocusout、onkeyup 在生產站點上未按預期工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在使用 jQuery 驗證插件 v.1.9.0 它可以工作很友好地.但是我面臨這個問題,一旦用戶提交表單 &如果有任何錯誤,它會正確顯示錯誤消息.問題在于,如果用戶采取措施糾正該錯誤,它不會更新消息.例如.如果需要一個字段,則在第一次收到消息時,用戶開始輸入,然后該消息應該消失.

I am using jQuery Validate plugin v.1.9.0 it works very nicely. But I am facing this issue, once the user submits the form & if there are any errors, it correctly display error message. The problem is that it does not update the message if the user takes an action to remedy that error. E.g. if a field is required, upon getting the message the first time, user starts typing, then that message should go away.

在文檔中提到 onfocusout &onkeyup 用于此目的 &默認情況下,它們設置為 true.有趣的是,它似乎可以在我的本地工作站上運行,但是一旦我將代碼上傳到生產站點,它就會(默默地)失敗.我以為我以某種方式把它搞砸了,所以我啟動了 jsfiddle 并輸入了相關代碼 看看它是否也發生在那里.

In the docs it mentions that onfocusout & onkeyup are used for this purpose & by default they are set to true. The funny thing is it seems to work on my local workstation but it fails (silently) once I upload my code to production site. I thought I was messing it up royally somehow so I fired up jsfiddle and put relevant code to see if it happens there as well.

我很驚訝地看到它也發生在那里.所以我的問題是為什么它可以在我的本地機器上運行,但不能在生產站點上運行?

I was amazed to see it happens there as well. So my question is why does it work on my local machine but not on production sites?

附:http://jsfiddle.net/tankchintan/cge44/5/的獨立示例

更新

要復制問題,請執行 -

To replicate the issue, do -

  1. 轉到 jsfiddle 頁面.
  2. 無需填寫任何字段點擊提交表單.
  3. 它會在每個字段旁邊顯示錯誤消息.
  4. 現在開始在任一字段中輸入內容.
  5. 您會注意到,即使滿足規則,錯誤消息也不會消失.在我的本地機器上,一旦我在該字段中輸入任何內容,錯誤消息就會消失.

推薦答案

這個問題甚至在JQuery網站的一些例子中也存在.

This problem even exists in some of the examples on the JQuery website.

我發現當輸入元素沒有類型時會出現問題.如果未指定,Web 瀏覽器假定類型為文本",但 jquery.validate 存在問題.您的輸入元素應如下所示:

I found that the problem occurs when the input element has no type. Web browsers assume that the type is "text" if not specified, but jquery.validate has a problem with that. Your input element should look like this:

<input id="cname" name="name" type="text" class="required" minlength="2" />

這篇關于使用 jQuery 驗證插件:onfocusout、onkeyup 在生產站點上未按預期工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設置值/標簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當文本框獲得焦點時選擇所有內容)
主站蜘蛛池模板: 欧美不卡一区 | 五月婷婷中文字幕 | 精品日韩一区二区 | 二区三区在线观看 | a毛片大片 | 日本一本草久p | 中文字幕在线播放视频 | a级黄毛片| 久久精品久久久久久久 | 在线播放黄色 | 六月激情 | 一级国产片 | 日韩不卡免费视频 | 欧美色综合 | 国产精品一区一区三区 | 亚洲黄色小视频 | 大尺度做爰床戏呻吟舒畅 | 日韩精品一区二区三区免费视频 | 免费视频a | 欧美一区二区精品 | 中文字幕欧美激情 | 在线一区| 婷婷91 | 日韩一级片 | 麻豆黄色片 | 欧美日韩国产在线 | av不卡在线观看 | 免费一级片 | 四虎影院在线 | 中文一区二区 | 免费a网站 | 99久久精品国产一区二区三区 | www免费视频 | 亚洲美女在线视频 | 天堂成人在线 | 天天干天天爽 | 成年人小视频 | 五月婷婷深深爱 | 日韩国产在线播放 | 欧美精品99久久久 | 亚洲最新视频 |