Note that there are some explanatory texts on larger screens.

plurals
  1. POCanceling form submit
    primarykey
    data
    text
    <p>In the following code I tried to close the popup form which was from jquery and not to submit action when I click no button and delete when I click delete. It worked earlier but now even when I click cancel the form submits to the contoller and delete action is done. What has gone wrong? how can I make the cancel button close the popup but not submit.help please!</p> <pre><code>@using (Html.BeginForm()) { &lt;fieldset style="width:70%;"&gt; @Html.Hidden("CnoType", Model.CnoType, Model) &lt;b&gt; Description: &lt;/b&gt; @Html.DisplayFor(Desc=&gt;Model.CNoDesc)&lt;br /&gt; &lt;b&gt; Prefix:&lt;/b&gt;&amp;nbsp;&amp;nbsp; @Html.DisplayFor(Prefix=&gt;Model.CnoPrefix)&lt;br /&gt; &lt;b&gt;Is Enable&lt;/b&gt; &amp;nbsp; @Html.CheckBox("IsEnable", Model.IsEnable, Model) &lt;/fieldset&gt; &lt;input id="btn" type="submit" value="Delete" /&gt; &lt;button class="Close"&gt;Cancel&lt;/button&gt; } </code></pre> <p>Here is my jquery</p> <pre><code>&lt;script type="text/javascript"&gt; $.ajaxSetup({ cache: false }); $(document).ready(function () { $(".openDialog").live("click", function (e) { e.preventDefault(); $("&lt;div&gt;&lt;/div&gt;") .addClass("dialog") .attr("id", $(this) .attr("data-dialog-id")) .appendTo("body") .dialog({ title: $(this).attr("data-dialog-title"), minWidth: 500, minHeight: 100, resizable: false, close: function () { $(this).remove() }, modal: true }) .load(this.href); }); $(".close").live("click", function (e) { e.preventDefault(); $(this).closest(".dialog").dialog("close"); }); }); &lt;/script&gt; </code></pre> <p>e.preventDefault() does not seem to be working</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload