Skip to content

Instantly share code, notes, and snippets.

@jrevillini
Last active August 12, 2019 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrevillini/4c18d6265ea3e2369d9813210ed122b1 to your computer and use it in GitHub Desktop.
Save jrevillini/4c18d6265ea3e2369d9813210ed122b1 to your computer and use it in GitHub Desktop.
// this should work in most cases to fix escaped quotes when querystring var has a quote (' or ") and is the value of an input or textarea
// it does not handle hidden fields ... feel free to improve on it or leave a comment with ideas
jQuery( function ( $ ) {
$( document ).on( 'nfFormReady', function ( ) {
$( 'textarea.ninja-forms-field,input[type=text].ninja-forms-field' ).each( function () {
var $input = $(this),
val = $input.val();
val = val.replace(/\\'/gm,"'").replace(/\\"/gm,'"');
$input.val(val).change();
} ); //each
} ); // nfFormReady event
} ); // ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment