Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Validate Options not working MVC3 Razor
    primarykey
    data
    text
    <p>I am trying to get a simple ignore working for the JQuery validate and I dont seem to be able to get it to work. No matter what I do it seems to not use the options. I have trimmed the code down and pasted below. Thanks for any help.</p> <p>I am using MVC3 Razor and JQuery 1.5.1</p> <pre><code>@Code ViewData("Title") = "Index" Layout = "~/Areas/Quote/Views/Shared/_Layout.vbhtml" End Code &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#myform').validate({ ignore: "#textx" }) }); &lt;/script&gt; @Using Html.BeginForm("Index", "YourQuote", FormMethod.Post, New With {.id = "myform"}) @&lt;input type="text" id="textx" class="required"/&gt; @&lt;input type="submit" value="save" /&gt; End Using </code></pre> <p>Thanks for the reply. The example is simplified but what I really want to do is have an overriding rule which says ignore all hidden elements from validation. My page is dynamically built and removing class and adding them back in when parent elements are hidden or shown is not good for me</p> <pre><code>@Code ViewData("Title") = "Index" Layout = "~/Areas/Quote/Views/Shared/_Layout.vbhtml" End Code &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#myform').validate({ ignore: ":hidden" }) }); &lt;/script&gt; @Using Html.BeginForm("Index", "YourQuote", FormMethod.Post, New With {.id = "myform"}) @&lt;div style="display:none"&gt; &lt;input type="text" id="textx" class="required"/&gt; &lt;/div&gt; @&lt;input type="submit" value="save" /&gt; End Using </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload