I have this on my cshtml:
<button onclick="save()" id="fundersSave" data-action="save-funder" type="button" class="btn btn-primary btn-lg">@Strings.Buttons_Save</button>
Then on my cshtml I have added the javascript:
<body>
<script type="text/javascript">
function save(){
var $form = $('.fancybox-inner').find('[data-area="funder-detail"]');
$form.on('click', '[data-action="save-funder"]', function () {
alert();
var selected1 = $form.find('input[type="radio"]:checked').val();
if ($('input[type="radio"]:checked').length == 0) {
parent.$.fancybox.close();
}
else {
document.getElementById("txtFunder").value = selected1;
parent.$.fancybox.close();
}
});
}
</script>
</body>
When I click on the [Save] button, I get undefined error.
如果您在_layout的底部包括了jquery库,请将其移动到body标签之后!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.