Microsoft JScript runtime error: Objekt unterstützt keine Eigenschaft oder Methode "live"?
Ich bin klicken auf die Schaltfläche wird die folgende Fehlermeldung angezeigt "Microsoft JScript runtime error: Objekt unterstützt keine Eigenschaft oder Methode "live""
Meine Ansicht-Seite ist wie folgt:
@model Charis.Models.Products
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="../../Content/CharisSite.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
@using (Html.BeginForm("Create", "Prod", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<table><tr><td>
<table>
<tr>
<td>
<fieldset>
<legend>Products</legend>
<table>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.Productname)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.Productname)
@Html.ValidationMessageFor(model => model.Productname)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.ProductPrice)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.ProductPrice)
@Html.ValidationMessageFor(model => model.ProductPrice)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.ProductDiscount)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.ProductDiscount)
@Html.ValidationMessageFor(model => model.ProductDiscount)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.LanguageType)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.LanguageType)
@Html.ValidationMessageFor(model => model.LanguageType)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.ReleaseDate)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.ReleaseDate)
@Html.ValidationMessageFor(model => model.ReleaseDate)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
<label for="file">Upload Image:</label>
</div>
</td>
<td>
<div class="editor-field">
<input type="file" name="file" id="file"/>
</div>
</td>
</tr>
</table>
</fieldset>
</td>
<td></td></tr>
</table>
</td></tr>
<tr><td>
<table>
<tr>
<td>
<fieldset>
<legend>Details</legend>
<table>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.AlbumDescription1)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.AlbumDescription1)
@Html.ValidationMessageFor(model => model.AlbumDescription1)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.AlbumDescription2)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.AlbumDescription2)
@Html.ValidationMessageFor(model => model.AlbumDescription2)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.Cast)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.Cast)
@Html.ValidationMessageFor(model => model.Cast)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.DirectedBy)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.DirectedBy)
@Html.ValidationMessageFor(model => model.DirectedBy)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.ProducedBy)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.ProducedBy)
@Html.ValidationMessageFor(model => model.ProducedBy)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
<label for="file">Upload Image1:</label>
</div>
</td>
<td>
<div class="editor-field">
<input type="file" name="file1" id="file1"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
<label for="file">Upload Image2:</label>
</div>
</td>
<td>
<div class="editor-field">
<input type="file" name="file2" id="file2"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
<label for="file">Upload Image3:</label>
</div>
</td>
<td>
<div class="editor-field">
<input type="file" name="file3" id="file3"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
<label for="file">Upload Image4:</label>
</div>
</td>
<td>
<div class="editor-field">
<input type="file" name="file4" id="file4"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
<label for="file">Upload Image5:</label>
</div>
</td>
<td>
<div class="editor-field">
<input type="file" name="file5" id="file5"/>
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.NoOfDisk)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.NoOfDisk)
@Html.ValidationMessageFor(model => model.NoOfDisk)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.Weight)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.Weight)
@Html.ValidationMessageFor(model => model.Weight)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.Format)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.Format)
@Html.ValidationMessageFor(model => model.Format)
</div>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</td></tr>
<tr><td>
<table><tr><td><fieldset><table>
<tr>
<td>
<p>
<input type="submit" value="Create" />
<input type="button" value="Clear" id="btnClear" />
</p>
</td>
</tr>
</table></fieldset></td></tr></table>
</td></tr>
</table>
}
@*<div>
@Html.ActionLink("Back to List", "Index")
</div>
*@
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
@if (TempData["notice"] != null)
{
<p style="color:Red;" >@TempData["notice"]</p>
}
live()
entfernt wurde, in jQuery 1.9. Ist das die version, die Sie verwenden?- stackoverflow.com/questions/14593724/jquery-1-9-0-live-function
- Live entfernt wurde als der 1.9
Du musst angemeldet sein, um einen Kommentar abzugeben.
sind Sie mit jquery neueste (1.9...), in denen
$(sel).live(...)
veraltet daher deine Fehlermeldung.1) verwenden Sie eine ältere version von jquery.
2) aktualisieren Sie Ihren code (ersetzen Sie live auf).
3) setzen Sie zurück die jquery-latest.
Können Sie auch einen Blick in einschließlich der jQuery-Migrate, um zu helfen mit der Aktualisierung auf jQuery 1.9
Ich rannte über diesem nach der Aktualisierung auf jQuery 1.9 mich. Allerdings merke ich, dass kein user (außer AliRıza Adıyahşi in einen link ohne Erklärung) bisher wies darauf hin, was Teil des Codes, die den Fehler verursacht wurde. Nach allem, wenn
$(sel).live(...)
war veraltet, zu Gunsten der$(sel).on(...)
dann ist es eine ziemlich einfache Lösung, rechts?Das problem ist, dass dieser Fehler wird geworfen inside
jquery.unobtrusive-ajax.js
, die Sie als Teil des Bundles, in@Scripts.Render("~/bundles/jqueryval")
Da Sie nicht mit den Ajax-Formular oder Abbrechen, wird der Fehler voraussichtlich nicht auf alles (nicht auf mir), aber ich war nicht in der Lage zu finden, etwas von Microsoft auf ein Update. Das Update, leider, ist zu gehen und fixieren Sie Ihre version von jquery.unobtrusive-ajax.js austauschen der .live-Anrufe zu .auf (), bis MS Updates der offizielle.