{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/jquery-validation-unobtrusive/issues/19","labels_url":"https://api.github.com/repos/aspnet/jquery-validation-unobtrusive/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/jquery-validation-unobtrusive/issues/19/comments","events_url":"https://api.github.com/repos/aspnet/jquery-validation-unobtrusive/issues/19/events","html_url":"https://github.com/aspnet/jquery-validation-unobtrusive/issues/19","id":122072903,"number":19,"title":"This version can't find the  @Html.ValidationMessage","user":{"login":"jcspader","id":1699660,"avatar_url":"https://avatars.githubusercontent.com/u/1699660?v=3","gravatar_id":"","url":"https://api.github.com/users/jcspader","html_url":"https://github.com/jcspader","followers_url":"https://api.github.com/users/jcspader/followers","following_url":"https://api.github.com/users/jcspader/following{/other_user}","gists_url":"https://api.github.com/users/jcspader/gists{/gist_id}","starred_url":"https://api.github.com/users/jcspader/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcspader/subscriptions","organizations_url":"https://api.github.com/users/jcspader/orgs","repos_url":"https://api.github.com/users/jcspader/repos","events_url":"https://api.github.com/users/jcspader/events{/privacy}","received_events_url":"https://api.github.com/users/jcspader/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-14T16:04:36Z","updated_at":"2015-12-15T17:20:24Z","closed_at":null,"body":"When I use  @Html.ValidationMessage from  ASP.NET MVC, this plugin can't find the correct element to work.\r\n\r\nFor test, you can use this page:\r\n\r\n```\r\n@using (Html.BeginForm(\"\", \"\", FormMethod.Get, new { novalidate = \"novalidate\", id = \"formTeste\" }))\r\n{\r\n    @Html.ValidationMessage(\"field2\")\r\n\r\n    <div class=\"form-control\">\r\n        @Html.Label(\"field1\")\r\n        @Html.TextBox(\"field1\", null, new { required = \"required\" })\r\n        @Html.ValidationMessage(\"field1\")\r\n    </div>\r\n\r\n    <div class=\"form-control\">\r\n        @Html.Label(\"field2\")\r\n        @Html.TextBox(\"field2\", null, new { required = \"required\" })\r\n    </div>\r\n\r\n   <button type=\"button\">Submit</button>\r\n}\r\n<script type=\"text/javascript\">\r\n    $(document).ready(function () {\r\n        $(\"#formTeste button\").on(\"click\", function () {\r\n            $(\"#formTeste\").valid();\r\n        });\r\n\r\n    });\r\n</script>\r\n```\r\n\r\nWhen submitting, it creates a new element down the field, ignoring the @Html.ValidationMessage."},"comment":{"url":"https://api.github.com/repos/aspnet/jquery-validation-unobtrusive/issues/comments/164832430","html_url":"https://github.com/aspnet/jquery-validation-unobtrusive/issues/19#issuecomment-164832430","issue_url":"https://api.github.com/repos/aspnet/jquery-validation-unobtrusive/issues/19","id":164832430,"user":{"login":"dougbu","id":6431421,"avatar_url":"https://avatars.githubusercontent.com/u/6431421?v=3","gravatar_id":"","url":"https://api.github.com/users/dougbu","html_url":"https://github.com/dougbu","followers_url":"https://api.github.com/users/dougbu/followers","following_url":"https://api.github.com/users/dougbu/following{/other_user}","gists_url":"https://api.github.com/users/dougbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dougbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougbu/subscriptions","organizations_url":"https://api.github.com/users/dougbu/orgs","repos_url":"https://api.github.com/users/dougbu/repos","events_url":"https://api.github.com/users/dougbu/events{/privacy}","received_events_url":"https://api.github.com/users/dougbu/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T17:20:24Z","updated_at":"2015-12-15T17:20:24Z","body":"Got it. The `jquery-validation-unobtrusive` code is creating `<span>` elements instead of using the existing ones. That is, it's not finding the elements with `data-valmsg-for=\"field1\"` or `data-valmsg-for=\"field2\"` attributes. Then `container` is an empty jQuery element after https://github.com/aspnet/jquery-validation-unobtrusive/blob/master/jquery.validate.unobtrusive.js#L42. Likely `this` references an unexpected element when `OnError()` is invoked."}}