I’m wondering what happen with jQuery using on ASP.NET MVC any jQuery code is not working specially in click methods
I’m using Razor view engines.
Any notice about this issue?
$(document).ready(function () {
$('.simpledialog').simpleDialog();
});
$('#button').click(function(){
//ToDo
});
I’ve added the dialog script and css :
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.5.1.js" type="text/javascript"></script>
but it always breaks when button is clicked and I receive an error :
Microsoft JScript runtime error :
Object doesn't support property or method 'dialog'
If the solution above does not work and you’re also using Telerik controls, you should add .jQuery(false) to the ScriptRegistrar tag at the bottom of your Views/Shared/_Layout.cshtml file. If you don’t do this, the asset.axd call is also loading (blindly) jQuery.