javascripthtmldrop-down-menupage-jump

Double Drop box going to page jump


First thanks in advance for your help. I am using markdownPad. I have created 2 drop box list as below.

<select>                                
  <option value="TTF">TTF</option>
  <option value="NBP">NBP</option>
  <option value="ZEE">ZEE</option>
  <option value="GP">GP</option>
  <option value="NCG">NCG</option>
  <option value="CEGH">CEGH</option>
  <option value="PNORD">PNORD</option>
  <option value="PSV">PSV</option>
</select>

<select>                                
  <option value="Q1-Q4, Q2-Q1, Q3-Q2, Q4-Q3">Q1-Q4, Q2-Q1, Q3-Q2, Q4-Q3</option>
  <option value="Winter-Summer, Summer(+1)-Winter">Winter-Summer, Summer(+1)-Winter</option>
  <option value="Jan-Dec(Y-1), Feb-Jan, March-Feb, Apr-March">Jan-Dec(Y-1), Feb-Jan, March-Feb, Apr-March</option>
  <option value="May-Apr, June-May, July-June, Aug-July">May-Apr, June-May, July-June, Aug-July</option>
  <option value="Sep-Aug, Oct-Sep, Nov-Oct, Dec-Nov">Sep-Aug, Oct-Sep, Nov-Oct, Dec-Nov</option>
  <option value="Q1-W(-1), Q2-S, Q3-S, Q4-W">Q1-W(-1), Q2-S, Q3-S, Q4-W</option>
  <option value="Jan-Q1, Feb-Q1, March-Q1, Apr-Q2">Jan-Q1, Feb-Q1, March-Q1, Apr-Q2</option>
  <option value="May-Q2, June-Q2, July-Q3, Aug-Q3">May-Q2, June-Q2, July-Q3, Aug-Q3</option>
  <option value="Sep-Q3, Oct-Q4, Nov-Q4, Dec-Q4">Sep-Q3, Oct-Q4, Nov-Q4, Dec-Q4</option>
</select>

I am trying to link the value of the two drop boxes to a page jump. Basically, if you select in the first one "TTF" and in the second one "Q1-Q4, Q2-Q1, Q3-Q2, Q4-Q3" I would like the page to go to the space where I wrote:

<A Name="TTF Q1-Q4, Q2-Q1, Q3-Q2, Q4-Q3">

Sorry if my question is stupid but I have no idea how to do that.


Solution

  • http://jsfiddle.net/nitd24/kyyupk3z/

    $('#secondSelect').change(function(){
     var fistSelectVal = $('#firstSelect').val();
        var secondSelectVal = $('#secondSelect').val();
    
        location.href = "#" + fistSelectVal + ' ' + secondSelectVal;
    })
    

    just give the div that you want your page to jump to as a combination of the values of both the dropdowns.

    Try if this is what you wanted??