JavaScript List Example [ Select and Option ]




Creating a list with single selection and multiple selection.
Creating a javascript to find the selected item from the list.

Original source


9 responses to “JavaScript List Example [ Select and Option ]”

  1. hi.. since u instantiated var x = f.hobby.options,

    could your if statement not be simplfied to something like

    if(x[i].selected) ??

    was just wondering.. since you only actually used x variable for the for statement, you might as well use it in the if statement as well?

  2. Hello I'm glad you took your time to answer my question 

    The thing is I want to add a value and calculations  to the 'selected options' using JavaScript 

    E.g if a person selects FROM : Cape town (10KM )TO : BELVIVL (40KM ) 

    It will cost him $10 everytime he travels for 10 KM 
    And if he's an adult it wil, cost him twice as more as compared to what a child would pay 

    I hope sound a bit clear now

  3. hi there hope you well
    I was wondering if you could help me with a bit of
    programming I'm using JavaScript im building a train app ,
    where users can purchase their tickets online , select their
    options and choose their destination .. the problem is I'm try
    to make a selection options;from___ and to__ on my app (in
    which I'm working on)…

Leave a Reply