我有动态选择(Razor插入了值),我尝试调用javascript函数,但是它不起作用。该功能没有响应。我尝试了'onclick'和'onselect'-他们都不起作用。我在想什么吗?
<select class="custom-select w-auto" id="AssetSelector">
<option value="Deafult">Choose Asset</option>
@foreach (var a in @Model.OwnAssetsList)
{
var AssetSerialModel = Newtonsoft.Json.JsonConvert.SerializeObject(a);
<option onchange="ShowAssetDetails(@AssetSerialModel)" value=@a.AssetID>Asset No: @a.AssetID</option>
}
</select>
@section scripts
{
<script type="text/javascript">
function ShowAssetDetails(asset)
{
console.log("check");
}
</script>
}