0
必要な入力があるフォームを持っていますが、jQueryはフィールドが有効ではないと言っています。それはHTMLによると価値があるように見えるので、奇妙です。フォームjQuery非妥当性検証が有効でない場合に有効返信
// First I ensure that the selector is correct. But I can see that it has value,
// when it is actually empty.
$('#form_0 input[name=Name]')[0].outerHTML
"<input data-val="true" data-val-length="The field Customer name must be a string with a minimum length of 3 and a maximum length of 20." data-val-length-max="20" data-val-length-min="3" data-val-required="The Customer name field is required." id="Name" name="Name" type="text" value=" Customer 0 " class="valid">"
// jQuery confirms that the field is empty
$('#form_0 input[name=Name]').val()
""
// but jQuery say that the control is valid :?
$('#form_0 input[name=Name]').valid()
1
と入力は、jQueryを使って動的に作成されています:
これは完全に空のテキストボックスを使ってChromeコンソールの三つのコマンドの出力です。
何が問題なのですか?
ありがとうございました。
テストするサイトのURLを教えてください。 –
残念ながら、私はコンセプトの証明をしようとするつもりはない、私はここにそれを置く。 – vtortola