File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
How to use this script:
3
3
1. Add a hidden form field for each query string parameter you’d like to capture.
4
- The field’s name and id should match the key of the query string parameter.
4
+ The field’s name should match the key of the query string parameter.
5
5
2. Include the script on the page(s) where you’d like to use it, and activate it in your JavaScript:
6
6
queryForm({reset: true});
7
7
The value {reset: true} is optional. Including it will clear (reset) parameter values after a form is submitted.
@@ -23,6 +23,6 @@ var queryForm = function(settings){
23
23
var hiddenFields = document . querySelectorAll ( "input[type=hidden]" ) ;
24
24
for ( var i = 0 ; i < hiddenFields . length ; i ++ ) {
25
25
var param = sessionStorage . getItem ( hiddenFields [ i ] . name ) ;
26
- if ( param ) document . getElementById ( hiddenFields [ i ] . name ) . value = param ;
26
+ if ( param ) document . getElementsByName ( hiddenFields [ i ] . name ) [ 0 ] . value = param ;
27
27
}
28
28
}
You can’t perform that action at this time.
0 commit comments