Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do I get an "Uncaught ReferenceError: $ is not defined (anonymous function)"
    primarykey
    data
    text
    <p>I have a cshtml page that gives these errors:</p> <pre><code>Uncaught ReferenceError: $ is not defined TabNotes:2 (anonymous function) TabNotes:2 TabNotes:12Uncaught ReferenceError: ko is not defined TabNotes:12 (anonymous function) TabNotes:12 (anonymous function) TabNotes:23 </code></pre> <p>What can cause such an error? I can't find any reason why this would be. I tried wrapping the javascript function in $(document).ready(function () { but that did not work either. The code is below</p> <pre><code>@model test.Web.Framework.Areas.Administration.Models.TabNotesModel @using (UI.DocumentReadyScript()) { if (Model.meta.id.HasValue) { UI.jQuery("#tbl" + Model.meta.modelname).flexigrid(Model.Grid); } } &lt;form method="post" action="@Url.Action("TabNotes", new { cmd = "refresh" })" id="@Model.meta.modelname"&gt; &lt;div class="ui-state-highlight ui-corner-all highlight" data-bind="visible: meta.message"&gt; &lt;span class="ui-icon ui-icon-info"&gt;&lt;/span&gt;&lt;strong data-bind="text: meta.message"&gt; &lt;/strong&gt; &lt;/div&gt; @using (UI.BeginBlock("Administation.TabNotes", UI.Label("Notes", "Notes").ToString(), test.Web.Framework.Core.enumIcons.pencil, false, false)) { &lt;table id="@("tbl" + Model.meta.modelname)"&gt; &lt;/table&gt; } &lt;/form&gt; &lt;script type="text/javascript"&gt; (function() { var viewModel=ko.mapping.fromJS(@Html.Raw(UI.JavascriptEncode(Model))); viewModel.getData=function() { return ko.mapping.toJSON( this ); }; viewModel.setData=function(data){ $('#tbl'+this.meta.modelname()).flexigrid( data.Grid); ko.mapping.updateFromJS(this,data); }; $('#@Model.meta.modelname').koform({viewmodel: viewModel , validate : {errorElement:'p' } } ); $('#@Model.meta.modelname').koform('applyBindings'); $('#load-partial').click(function() { $('#partial').load('@Html.Raw(@Url.Action("CreateNote", "Entity", new {modelEntity = @Model.meta.entity, itemId = @Model.meta.id}))'); }); })(); &lt;/script&gt; &lt;div id="partial"&gt;&lt;/div&gt; &lt;button type="button" id="load-partial"&gt;Create Note&lt;/button&gt; </code></pre> <p>edit: The jQuery gets loaded from the master page.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload