Sarra Sarra - 1 year ago 92
jQuery Question

Auto submit form in Razor

I want to submit automatically after click on label , I used Jquery but it did'nt work.

this is my Jquery Code :

<script type="text/javascript">

$("#tt").click(function () {

When T tested using alert function it works fine :

<script type="text/javascript">

$("#tt").click(function () {
alert("Bye! You now leave p1!");

tt is the id of label that I clicked on
This is razor code :

@using (Html.BeginForm("Index2", "Commande", FormMethod.Post, new { @class = "form-horizontal form-label-left", role = "form", @id = "demo-form2" }))

<th id="tt">
Code Article


help ,

Answer Source

The problem was that I am using a input named "submit" in the form When I changed the name "submit" jquey code Works fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download