-2
jquery
フォーム送信時に次のエラーが表示されます。そこにいくつかの記事は誤りでオンラインになっているが、何らかの理由で私はまだ、私は以下のjQueryコードで不足していることができるものを上明確ではないよ:JQuery TypeError - Callback.callが関数ではありません
エラー:
TypeError: callback.call is not a funtion
ノート:
- jqueryエラーですが、使用しているjqueryのバージョンとライブラリを表示するだけでエラーの詳細を追加しました。 Visual Studio 2015でASP.NET Core MVCプロジェクトを作成すると、jqueryのビルトイン構成です。
- 入力には金額が
$15,406.15
などと表示されていますが、入力前に$
と,
を削除しようとしています。フォームが提出されます。
エラーの詳細:
TypeError: callback.call is not a function at Function.each (http://localhost:50507/lib/jquery/dist/jquery.js:365:19) at jQuery.fn.init.each (http://localhost:50507/lib/jquery/dist/jquery.js:137:17) at HTMLFormElement.<anonymous> (http://localhost:50507/ControlleName:203:36) at HTMLFormElement.dispatch (http://localhost:50507/lib/jquery/dist/jquery.js:4737:27) at HTMLFormElement.elemData.handle (http://localhost:50507/lib/jquery/dist/jquery.js:4549:28)
ビュー:それぞれの
<form id="myform" asp-controller="CustOrders" asp-action="ProductPrices" method="post">
....
<tr>
<td>Item1:</td>
<td><input asp-for="item1_price" asp-format="{0:C}" class="inputclass" /></td>
</tr>
<tr>
<td>Item2:</td>
<td><input asp-for="item2_price" asp-format="{0:C}" class="inputclass" /></td>
</tr>
...
<tr>
<td>Item9:</td>
<td><input asp-for="item9_price" />></td>
</tr><tr>
<td>Item1:</td>
<td><input asp-for="item1_price" asp-format="{0:C}" class="inputclass" /></td>
</table>
<button type="submit" name="submit" value="Add">Update Report</button>
</form>
@section scripts
{
<script>
$(document).ready(function() {
$("#myform").submit(function() {
$('.inputclass').each($(this).val($(this).val().replace(/[$,]/g, '')));
});
});
</script>
}
それぞれあるべき機能を持っている必要がありあなたの '$(これは)' '$( '#のあるmyForm')を指し – epascarello
....それで機能を持っている必要があります'、それぞれの' $( '。inputclass') ' –