Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ninja Forms 3.0 On Form Load javascript event

I'm trying to find a javascript event that gets fired when a ninja form is ready and is loaded in the DOM.

I looked over the documentation and searched around google for a while, couldn't find anything...

I'm using Ninja Forms 3+ (even though 2 was a hella lot better....)

I'd rather not have an interval running to check if the form has been loaded yet.

Thanks!

like image 518
zsawaf Avatar asked Mar 20 '17 20:03

zsawaf


1 Answers

Unfortunately the pretty Ninja Forms plugin is not documented properly. Spent much time before I found this solution (using jQuery):

jQuery(document).on( 'nfFormReady', function() {
    console.log('Form is ready');
    // Place events handlers here:
    jQuery(".contact-form input[type=button]").on('click', function(){
        console.log('Do something');
    })
});
like image 172
Dzmitry Kulahin Avatar answered Oct 29 '22 13:10

Dzmitry Kulahin