Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2013
    Posts
    125
    Thanks
    3
    Thanked 0 Times in 0 Posts

    alert on form submit not working?!

    Please help, when i submit my form, I would like to alert some text but I can't

    Code:
    $("#loadingicon").hide();
    	$("#mainform").submit(function() {
    	    alert("Submitted");
    	    $("#loadingicon").show();
    	});

  • #2
    Regular Coder
    Join Date
    Apr 2013
    Posts
    125
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Thumbs up

    I had to put code in a loading handler

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,479
    Thanks
    6
    Thanked 981 Times in 954 Posts
    And you have to put your jQuery-related threads in the JS frameworks forum, I told you that numerous times. Why aren’t you obeying?

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    you can give this a try. Also this is basically a double post and you didnt answer anyone on the last thread either. if you want help you need to be more interactive.
    Code:
    $("#loadingicon").hide();
    	$("#mainform").submit(function(e) {
                e.preventDefault();
    	    alert("Submitted");
    	    $("#loadingicon").show();
    var t=setTimeout(function(){$("#mainform").submit()},3000)
    
    
    	});

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,471
    Thanks
    0
    Thanked 634 Times in 624 Posts
    If the checkbox to turn off JavaScript in the alert() gets checked then no further JavaScript in the page will run.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •