From 90b7453aa7b76f0b240085e5d115a701684b0306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 28 Sep 2016 14:05:34 +0200 Subject: [PATCH] Allow setting options before script is loaded --- live-form-validation.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/live-form-validation.js b/live-form-validation.js index 0b3c3ed..505cb10 100644 --- a/live-form-validation.js +++ b/live-form-validation.js @@ -62,6 +62,11 @@ LiveForm.setOptions = function(userOptions) { } } +// Allow setting options before loading the script just by creating global LiveFormOptions object with options. +if (typeof window.LiveFormOptions !== 'undefined') { + LiveForm.setOptions(window.LiveFormOptions); +} + LiveForm.isSpecialKey = function(k) { // http://stackoverflow.com/questions/7770561/jquery-javascript-reject-control-keys-on-keydown-event return (k == 20 /* Caps lock */