2013-03-06 63 views
0

我正在做一個複雜的註冊表單。我做了很多Jquery.validation,並且除了在一個表單元素之外完美工作。該表單元素是input = text。它在開始時被禁用,如果選擇了一個單選按鈕,它將被啓用。因此,我的驗證系統按預期工作,除了此輸入。Jquery無法驗證啓用的表格

下面是HTML代碼...

<form class="form_third"> 
     <div id="div_muayenehane" style="display:none"> 
     <div>Telefon&nbsp;<span id="Span13" style="font-size:11px;color:red"></div><div style="line-height: 3px">&nbsp;</div> 
     <div><input type="text" id="txt_telefon" name="txt_telefon" style="width: 200px" class="blue_input required" minlength="11" maxlength="11" placeholder="02125556677"; /></div><div style="line-height: 6px">&nbsp; 
     </div> 
    </div> 
    </form> 

這裏是jQuery代碼...

$("#form_third").validate({ 
      submitHandler: function() { 
       return false; 
      }, 
      errorPlacement: function (error, element) { 
       error.appendTo(element.parent().prev().prev().children('span')); 
      }, 
      rules: { 
       txt_telefon: { 
        required: true, 
        digits: true 
       } 
      } 
     }); 

應該驗證txt_telefon並顯示Span13錯誤信息,但它不工作。它什麼都不做。你以爲,因爲div_muayenehane是在負載禁用

回答

2

這個問題似乎是在這裏,我應該使用「對」事件或別的東西:

$("#form_third") 

應該

$(".form_third") 

自「form_third」是類屬性,而不是id。

+0

非常感謝你,它的工作。我會將它標記爲5分鐘內回答 – 2013-03-06 08:16:27

1

變化

$("#form_third") 


to 


$(".form_third") 

你需要使用。(點)類和#的標識。

2

你的表單標籤中的位變化<form id="form_third" class="form_third">