<p>After trying to avoid JavaScript for years, Iv started using Query for <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow noreferrer">validation</a> in MVC asp.net, as there does not seem to be an official way of doing validation, Iv been surprised how good jQuery is. </p>

<p>Firstly is there a way to get intellisense working for jQuery and its validation plugin, so that i don have to learn the api?</p>

<p>Secondly how do I create a validation summary for this, it currently appends the error to the right of the text box.:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$().ready(function() {
$("#CreateLog").validate({
        rules: {            
            UserName: {
                required: true,
                minLength: 2,

            }
        },
        messages: {

            UserName: {
                required: "Please enter a username",
                minLength: "Your username must consist of at least 2 characters",

            }
        }
    });
});
&lt;/script&gt;

&lt;form id="CreateLog" action="Create" method="post" /&gt;   
        &lt;label&gt;UserName&lt;/label&gt;&lt;br /&gt;
        &lt;%=Html.TextBox("UserName")%&gt; 
         &lt;br /&gt;  
          &lt;div class="error"&gt; &lt;/div&gt;
        &lt;input  type=submit value=Save /&gt;
       &lt;/form&gt;
</code></pre>

<p>I tried adding this to the script:</p>

<pre><code> errorLabelContainer: $("#CreateLog div.error")
</code></pre>

<p>and this to the html:</p>

<pre><code>  &lt;div class="error"&gt; &lt;/div&gt;
</code></pre>

<p>But this didn't work.</p>

[{'answer_id': 61460, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 2, 'selected': False, 'text': '<p>There is a Visual Studio 2008 hotfix for <a href="http://weblogs.asp.net/bradvincent/archive/2008/04/28/better-jquery-intellisense-in-vs2008.aspx" rel="nofollow noreferrer">JQuery IntelliSense</a> in <a href="http://weblogs.asp.net/scottgu/archive/2007/06/21/vs-2008-javascript-intellisense.aspx" rel="nofollow noreferrer">VS2008</a> . This might have been bundled with SP1 as well.</p>\n'}, {'answer_id': 66527, 'author': "Dane O'Connor", 'author_id': 1946, 'author_profile': 'https://Stackoverflow.com/users/1946', 'pm_score': 5, 'selected': True, 'text': '<p>Try specifying both a wrapper and a label container in your options. I also added <code>display:none;</code> to the style of error-container to let jQuery decide when to show it.</p>\n\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>$().ready(function() {\r\n  $("#CreateLog").validate({\r\n    errorLabelContainer: $("ul", $(\'div.error-container\')),\r\n    wrapper: \'li\',\r\n    rules: {            \r\n        UserName: {\r\n            required: true,\r\n            minLength: 2,\r\n\r\n        }\r\n    },\r\n    messages: {\r\n      UserName: {\r\n        required: "Please enter a username",\r\n        minLength: "Your username must consist of at least 2 characters"\r\n      }\r\n    }\r\n  });\r\n});</code></pre>\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;\r\n&lt;div class="error-container"&gt;\r\n  &lt;ul&gt;&lt;/ul&gt;\r\n&lt;/div&gt;\r\n\r\n&lt;form id="CreateLog" action="Create" method="post" /&gt;   \r\n  &lt;label&gt;UserName&lt;/label&gt;&lt;br /&gt;\r\n  &lt;%=Html.TextBox("UserName")%&gt; \r\n  &lt;br /&gt;  \r\n  &lt;input  type=submit value=Save /&gt;\r\n&lt;/form&gt;</code></pre>\r\n</div>\r\n</div>\r\n</p>\n\n<p>That should work.</p>\n'}, {'answer_id': 298664, 'author': 'Tomas Aschan', 'author_id': 38055, 'author_profile': 'https://Stackoverflow.com/users/38055', 'pm_score': 1, 'selected': False, 'text': '<p>regarding intellisense for jquery (and other plugins): in order to have full intellisense in your own script files as well, just include the following line at the top of your .js file once for each file you want intellisensee from:</p>\n\n<pre><code>/// &lt;reference path="[insert path to script file here]" /&gt;\n</code></pre>\n\n<p>simple, but very useful =)</p>\n'}, {'answer_id': 815368, 'author': 'Soni Ali', 'author_id': 93141, 'author_profile': 'https://Stackoverflow.com/users/93141', 'pm_score': 3, 'selected': False, 'text': '<p>You might want to check out <a href="http://codebetter.com/blogs/karlseguin/default.aspx" rel="noreferrer">Karl Seguin</a>\'s ASP.NET MVC validation approach on <a href="http://codebetter.com" rel="noreferrer">CodeBetter.com</a> and his sample <a href="http://codebetter.com/blogs/karlseguin/archive/2009/04/28/presenting-codebetter-canvas.aspx" rel="noreferrer">application canvas</a>.</p>\n\n<p><a href="http://codebetter.com/blogs/karlseguin/archive/2009/04/26/validation-part-1-getting-started.aspx" rel="noreferrer">Validation - Part 1 - Getting Started</a></p>\n\n<p><a href="http://codebetter.com/blogs/karlseguin/archive/2009/04/27/validation-part-2-client-side.aspx" rel="noreferrer">Validation - Part 2 - Client-Side</a></p>\n\n<p><a href="http://codebetter.com/blogs/karlseguin/archive/2009/04/28/validation-part-3-server-side.aspx" rel="noreferrer">Validation - Part 3 - Server-Side</a></p>\n'}]
['https://Stackoverflow.com/questions/61456', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/230/']