• hi , i create simple drop list

    <select onchange="la(this.value)">
    <option disabled selected>where to ?</option>
    <option value="https://***.com">page one</option>
    <option value="https://***.com">page one</option>
    </select>
     
    <script>
    function la(src)
    {
    window.location=src;
    }
    </script>

    i don’t want when i select option go to url , i want to create Submit button and when choose an option nothing happened till click submit button

    **** i found this script too , work well but it get strings from options and add url to them , i want to define it manually

    <div>
    
      <H1><FONT="TIMES ROMAN" FONT-COLOR="BLUE" > SELECT An subject:</H1>
    
      <select id ="dropDownId"> <!-- give an id to select box-->
    
          <option value="">Select Option</option>
          <option value="physics">physics</option>
          <option value="chemistry">chemistry</option>
          <option value="biology">biology</option>
          <option value="maths">maths</option>
          <option value="cs">cs</option>
          <option value="electrical">electrical</option>
    
      </select>
      <br>
      <input class="SubmitButton" type="submit" name="SUBMITBUTTON"  value="Submit" style="font-size:20px; " />
    </div>
    <script src = "//code.jquery.com/jquery-3.0.0.min.js"></script> <!-- add jquery library-->
    <script type = "text/javascript">
    $('.SubmitButton').click(function(){ // on submit button click
    
        var urldata = $('#dropDownId :selected').val(); // get the selected  option value
        window.open("http://"+urldata+".html") // open a new window. here you need to change the url according to your wish.
    });
    
    </script>
    • This topic was modified 6 years, 7 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Droplist ( option list ) with submit button’ is closed to new replies.