Skip to content

Commit

Permalink
Allow setting options before script is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Robyer authored Sep 28, 2016
1 parent 80e6721 commit 90b7453
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions live-form-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 90b7453

Please sign in to comment.