I’m deploying some code to a website and when I do the JavaScript does not run. I get the error:
SCRIPT5007: The value of the property ‘$’ is null or undefined, not a Function object.
The code it is using is
@model MVCMasterDetail.DataAccess.cwwoLoadCurrentWorkOrderActualsResult[]
<script type="text/javascript">
$(document).ready(function () {
$(".grid-toggle").click(function () {
$(this).closest("table").find("tbody").show();
});
$(".hide-rows").click(function () {
$(this).closest("table").find("tbody").hide();
});
});
</script>
@Html.Partial("MasterDetailMasterPartial")
And what calls uses it is:
<td colspan="4"> Details<br/><a href="javascript: void(0)" class="grid-toggle">Show- </a><a href="javascript: void(0)" class="hide-rows">Hide</a></td>
Any help is appreciated.
You need to include jQuery before any other scripts. It sounds like you have something like
instead of
Check that it appears in your HTML source before any other scripts that use it.