Custom jQuery not working on Wordpress Ninja Forms plugin

后端 未结 2 1110
再見小時候
再見小時候 2021-02-08 23:17

I am having some problems when I want to add custom jQuery code that affects the form.

For example when someone clicks an input or radio button another input or element

2条回答
  •  死守一世寂寞
    2021-02-08 23:55

    Not sure if you need help with this any more as it's been some time since you posted your question, but this may help others in the future. I had the same/similar issue with not being able to run JS/jQuery on the Ninja Forms and found that it's because Ninja Forms load their forms asynchronously. So, when your document.ready function runs, the form doesn't yet exist and it's not able to bind.

    Ninja Forms have their own event ready state that can be used as follows:

    jQuery(document).on( 'nfFormReady', function( e, layoutView ) {
        // Your code goes here...
    });
    

提交回复
热议问题