PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

jquery change input value with click handler

  1. I am trying to change the text in the submit button on click. Trying to stop multiple submitters.
    I have this in header.php:

    <script type="text/javascript">
    $("form.buttontext")
    .submit(function() {
    var $form = $(this);
    $.post($form.attr('action'), function(){
    var $submit = $form.find("input:submit").val('Processing');
    window.setTimeout(function() {
    $submit.val('Register Now');
    }, 5000);
    });
    return false; //
    });​
    </script>

    also tried disabling submit on click:

    $('input:submit').click(function(){
    	$('input:submit').attr("disabled", true);
    });

    Also tried this:

    $(document).ready(function(){
                    $('#gform_submit_button_6').click(function(){
                    $('input:submit').attr("disabled", true);
                    });
            });

    Can someone please shed some light on where I am going wrong? I cannot get a click handler to work. I tried the submit handler too. No luck. I am obviously new to this and trying to learn!

    Posted 12 years ago on Tuesday December 11, 2012 | Permalink
  2. Please provide a link to the page on your site where this form and functionality are present, so we can take a look. Thank you.

    Posted 12 years ago on Monday December 17, 2012 | Permalink