Terug naar overzicht

JS API

Events

Field events

Available field events:

  • onkeyup
  • onchange
  • onajaxloaded

Usage

const field = PeggyPay.getField("myFieldName");
field.onchange.add( function(field)  ...   )

Global onload event

To execute code when your form is ready (DOM document) but not shown yet, use this:

window.PeggyPay.events.formReadyInternal.push( () => {} )

You should also check if that object is already created by Peggy Pay. Peggy will extend the PeggyPay object if already exists, so:

if (typeof window.PeggyPay === "undefined" || !window.PeggyPay) {
    window.PeggyPay = {
        events: {
            formReadyInternal: []
        }
    };
}