Hi Guys. I have a form that will be submitted when a button on my toolbar is clicked. That button is outside the form. How do I achieve this, below is what I have tried so far. Thanks.
The Button
<li>
<a id="frmsub" title="" data-placement="bottom" data-title="Save" onclick="$('#testfrm').submit()">
<span class="glyphicon glyphicon-floppy-save"></span>
</a>
</li>
My Form
<div class="vx-ds-widget">
<div class="container">
@using (Html.BeginForm("EditCreateProfile", "Manage", FormMethod.Post, new { @id = "testfrm" }))
I have also tried this but not is working so far
$('#frmsub').click(function () {
$('#testfrm').submit();
});
Try:
<script type="text/javascript">
$(function () {
$('#frmsub').click(function () {
$('#testfrm').submit();
return false; // to prevent link navigation
});
});
</script>
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.