Click here to Skip to main content
14,739,600 members
Home » Discussions » JavaScript
   

JavaScript

 
AnswerRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 1:41
mveRichard Deeming15-Jun-20 1:41 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 2:00
Memberand180y15-Jun-20 2:00 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 2:15
mveRichard Deeming15-Jun-20 2:15 
If you really want to match based on the index of the parameter, then you could try:
const searchParams = new URLSearchParams(location.search);
let index = 0;

for (const [key, value] of searchParams) {
    let element = document.getElementsByClassName("dropdown")[index];
    element.value = value;
    index++;
}
This assumes that the value already exists in the list. If you want to add a new option instead:
let element = document.getElementsByClassName("dropdown")[index];
let option = document.createElement("option");
option.value = value;
option.text = value;
element.add(option, null);
element.value = value;




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 2:24
Memberand180y15-Jun-20 2:24 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 2:27
mveRichard Deeming15-Jun-20 2:27 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 2:46
Memberand180y15-Jun-20 2:46 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 5:59
mveRichard Deeming15-Jun-20 5:59 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 9:56
Memberand180y15-Jun-20 9:56 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 9:58
mveRichard Deeming15-Jun-20 9:58 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 10:07
Memberand180y15-Jun-20 10:07 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 10:16
mveRichard Deeming15-Jun-20 10:16 
QuestionJavascript function error. Pin
and180y9-Jun-20 14:55
Memberand180y9-Jun-20 14:55 
AnswerRe: Javascript function error. Pin
Richard MacCutchan9-Jun-20 22:03
mveRichard MacCutchan9-Jun-20 22:03 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 0:27
Memberand180y10-Jun-20 0:27 
GeneralRe: Javascript function error. Pin
Richard MacCutchan10-Jun-20 0:36
mveRichard MacCutchan10-Jun-20 0:36 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 1:21
Memberand180y10-Jun-20 1:21 
GeneralRe: Javascript function error. Pin
Estys10-Jun-20 1:31
MemberEstys10-Jun-20 1:31 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 1:59
Memberand180y10-Jun-20 1:59 
GeneralRe: Javascript function error. Pin
Richard MacCutchan10-Jun-20 1:37
mveRichard MacCutchan10-Jun-20 1:37 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 1:58
Memberand180y10-Jun-20 1:58 
GeneralRe: Javascript function error. Pin
Richard MacCutchan10-Jun-20 2:18
mveRichard MacCutchan10-Jun-20 2:18 
AnswerRe: Javascript function error. Pin
Richard Deeming10-Jun-20 0:13
mveRichard Deeming10-Jun-20 0:13 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 0:25
Memberand180y10-Jun-20 0:25 
GeneralRe: Javascript function error. Pin
Richard Deeming10-Jun-20 2:26
mveRichard Deeming10-Jun-20 2:26 
GeneralRe: Javascript function error. Pin
and180y10-Jun-20 2:55
Memberand180y10-Jun-20 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.