Jquery trigger when "Gravity Forms" input button is pressed

I updated the question because it could be due to forms of gravity that stop a simple function from working. The reason I say this is because I tried so many parameters (listed below) to call the jQuery function, and none of them work when they should.

I have a simple function below which 100% works ...

var $contactButton  = $(".contact-slide a"),
    $contactSlide   = $("#horizon-slide");

function () {
    $contactSlide.stop().css("top","0");
};

Simple as it turns out, but I try to call it when my submit button gets a click from gravity.


This is a text markup of Wordpress gravitational form ...

<input type="submit" id="gform_submit_button_1" class="button gform_button" value="Send" tabindex="7"></input>


These are all the scripts below that I tried, but none of them run the function ...

Script One

$("input#gform_submit_button_1").on('click', function () {
    $contactSlide.stop().css("top","0");
});

Script Two

$("input#gform_submit_button_1").click(function() {
    $contactSlide.stop().css("top","0");
});

Script Three

$("input#gform_submit_button_1").focus(function () {
    $contactSlide.stop().css("top","0");
});

Script Four

$("form#gform_1").submit(function(event) {
$contactSlide.stop().css("top","0");
});


I also tried ...

return false; 

and

return true;

, . false, , true, , .


, , ?

.

+5
3

- ? AJAX , gform_confirmation_loaded JavaScript .

$(document).on('gform_confirmation_loaded', function(e, form_id){
   if(form_id == 2) {
       $contactSlide.stop().css("top","0");
   }
});

, , form_id, .

+6
$contactInput.focus(function () {
    $contactSlide.stop().css("top","0");
    $('body,html').animate({
        scrollTop: 0
    }, 0);
    return true;
});

:)

0

You can manage it from the submit form if you have a form.

<script type="text/javascript" src="js/jquery1.6.1.js"></script>
<script type="text/javascript">
 $(document).ready(function () {
   $("#forma").submit(function(event) {
       //do what ever you need to here
        return false;
    });
});
</script>
<form name="1stform" method="post" action="/">
    <input type="text" name="misc" id="misc" />
    <input type="submit" name="submit" id="submit" value="submit 1st form"/>
</form>
0
source

All Articles