Need help submitting form using .submit()
Hey Guys,
I am trying to simply submit a form when clicking the enter key. For some reason the form does not do any submission. It will do other things like if I do an alert("Hello World") when clicking on enter but not submitting the form.
Can someone help me figure out why this isn't working
below is the code
Thanks
- <form id="form" action="radio.html" method="post">
- <input id="1" class="rad" type="radio" name="rad">
- <div class="text_1"> Some text 1 </div>
- <input id="submit" type="submit" value="submit"/>
- </form>
- $(document).on("keypress",function(e){
- var key = e.which;
- if(key == 13){
- $("#form").submit(function() { return true;});
- //$("#form").trigger("submit");
- }
- });