简体   繁体   English

将jQuery与HTML表单及其元素结合使用以进行验证

[英]Using jquery with Html form and its elements for validation

Please help me with a problem. 请帮我解决一个问题。 I am using the following jquery code for validation. 我正在使用以下jquery代码进行验证。

$(function(){
  $("#signup_step1").validationEngine('attach', 
      {promptPosition : "centerRight", autoHidePrompt:true, autoHideDelay: 900});

I have a form like this 我有这样的形式

 <form id="signup_step1" 
       name="signup_step1" 
       method="post" 
       enctype="multipart/form-data">

I have different input element for which the validation is called and that is working fine. 我有不同的输入元素,需要对其进行验证,并且工作正常。

The problem is for some elements I would like to change the position of the error message. 问题是某些元素我想更改错误消息的位置。 When i try to give a new id to the input element and make copy the give jquery function and editing the id with the new one it doesn't work. 当我尝试给输入元素一个新的ID并进行复制Give Jquery函数并用新的ID编辑ID时,它不起作用。 Please Help 请帮忙
Note: I am using php to save and echo out the errors so that isn't the problem. 注意:我正在使用php保存并回显错误,所以这不是问题。 The problem is I want to change the position of the displayed error for some input elements 问题是我想更改某些输入元素的显示错误的位置

  1. Could you please make sure there are no duplicate ID for your new added elements. 您能否确保新添加的元素没有重复的ID。
  2. Make sure your new copy past javascript functions in the jQuery's DOM ready functions( $(function(){} ) 确保通过jQuery的DOM ready函数($(function(){})中的javascript函数复制新副本

If this wouldn't help you fix your problem, could you please past the codes for the new added elements? 如果这不能帮助您解决问题,能否请您跳过新添加的元素的代码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM