I'm developing Asp.Net MVC application. I'm using partial view for menu in Layout form for some views. I need use JavaScript on this view, but its work only on first time - after view loaded. Later - doesn't. Partial View is like this:
@Scripts.Render("~/bundles/jquery")
@Html.CheckBox("IsChoosed", true, new { onclick = "FormReload();" })
<script>
$(".IsChoosed").on("onchange", function () {
FormReload();
});
var FormReload = new function ()
{
alert("FormReload");
};
</script>
LayoutForm:
@Html.Partial("_ViewPartial")
@RenderBody()
Alert message is displayed after loading of page, when checkbox value set. But after while i'm changing value - doesn't. I tried to move JavaScritp methods to ***.js file and hook up it in view, but its worked the same way. Where can be an error?