Click here to Skip to main content
14,574,365 members

JavaScript

 
QuestionAny tips? I am brand new and created a binary translator. I'm open to feedback. Pin
Hany Halim1-Jul-20 9:55
MemberHany Halim1-Jul-20 9:55 
QuestionRe: Any tips? I am brand new and created a binary translator. I'm open to feedback. Pin
Richard MacCutchan1-Jul-20 22:41
mveRichard MacCutchan1-Jul-20 22:41 
AnswerRe: Any tips? I am brand new and created a binary translator. I'm open to feedback. Pin
Richard Deeming1-Jul-20 23:45
mveRichard Deeming1-Jul-20 23:45 
QuestionCannot read back correct JSON from excel workbook Pin
kjeeva28-Jun-20 10:57
Memberkjeeva28-Jun-20 10:57 
QuestionI am creating a program with Visual Basic Script files with C++. Pin
c0d3r1/226-Jun-20 7:15
Memberc0d3r1/226-Jun-20 7:15 
AnswerRe: I am creating a program with Visual Basic Script files with C++. Pin
Bohdan Stupak29-Jun-20 4:18
professionalBohdan Stupak29-Jun-20 4:18 
AnswerRe: I am creating a program with Visual Basic Script files with C++. Pin
ZurdoDev29-Jun-20 4:35
mveZurdoDev29-Jun-20 4:35 
Questionhow to get audio play auto work in mobile browsers andriod & ios Pin
Member 1486961821-Jun-20 20:38
MemberMember 1486961821-Jun-20 20:38 
QuestionNeed javascript code support for below request Pin
mikt201618-Jun-20 0:57
Membermikt201618-Jun-20 0:57 
AnswerRe: Need javascript code support for below request Pin
ZurdoDev18-Jun-20 2:00
mveZurdoDev18-Jun-20 2:00 
AnswerRe: Need javascript code support for below request Pin
Richard MacCutchan18-Jun-20 4:43
mveRichard MacCutchan18-Jun-20 4:43 
QuestionAccordion not working properly with dynamic content Pin
mhutch2617-Jun-20 4:09
Membermhutch2617-Jun-20 4:09 
QuestionData from one page to another with a twist. Pin
and180y14-Jun-20 10:33
Memberand180y14-Jun-20 10:33 
AnswerRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 0:41
mveRichard Deeming15-Jun-20 0:41 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 1:00
Memberand180y15-Jun-20 1:00 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 1:15
mveRichard Deeming15-Jun-20 1:15 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 1:24
Memberand180y15-Jun-20 1:24 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 1:27
mveRichard Deeming15-Jun-20 1:27 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 1:46
Memberand180y15-Jun-20 1:46 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 4:59
mveRichard Deeming15-Jun-20 4:59 
Ah, no, sorry. I thought you were trying to put the values into the text inputs.

Given a select list:
<div class='dropdown-container row p-4'>
    <select>
        <option class='dropdown'>level-1</option>
        <option class='dropdown'>level-2</option>
        <option class='dropdown'>level-3</option>
        <option class='dropdown'>level-4</option>
        <option class='dropdown'>level-5</option>
        <option class='dropdown'>level-6</option>
    </select>
</div>
and the URL: overheads5.html?level-1=10&level-2=20&level-3=30&level-4=40&level-5=&level-6=

then something like this should work:
const searchParams = new URLSearchParams(location.search);
const elements = document.getElementsByClassName("dropdown");
let index = 0;

for (const [key, value] of searchParams) {
    let element = elements[index];
    element.text = value;
    index++;
}
Demo[^]



"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 8:56
Memberand180y15-Jun-20 8:56 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 8:58
mveRichard Deeming15-Jun-20 8:58 
GeneralRe: Data from one page to another with a twist. Pin
and180y15-Jun-20 9:07
Memberand180y15-Jun-20 9:07 
GeneralRe: Data from one page to another with a twist. Pin
Richard Deeming15-Jun-20 9:16
mveRichard Deeming15-Jun-20 9:16 
QuestionJavascript function error. Pin
and180y9-Jun-20 13:55
Memberand180y9-Jun-20 13: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.