skip to Main Content

How can I open different pages from a single button by using a pair of two different dropdown menus?

image

<table  style="font-style:nunito; background-color:#FFEBF6;border:none;">  
    <tr>
    <td style="font-style:nunito; background-color:#FFEBF6;border:none;">
        <label style="font-size:20px; padding-bottom:10px;">My credit score is</label>  
        <select id="selectBox1">        
            <option value="excellent">Excellent (720 - 850) </option>
            <option value="good">Good (690 - 719)</option>
            <option value="average">Average (630 - 689)</option>
            <option value="poor">Poor (350 - 629)</option>
        </select>
    </td>
    
    <td style="font-style:nunito; background-color:#FFEBF6;border:none;">
        <label style="font-size:20px; padding-bottom:10px;">I care most about</label>
        <select id="selectBox2">        
            <option value="a">Cash Back</option>
            <option value="b">Rewards</option>
            <option value="c">Travel</option>
            <option value="d">Balance Transfer</option>
            <option value="e">Low Interest</option>
            <option value="f">Building My Credit</option>
        </select>
    </td>
        
    <td style="font-style:nunito; background-color:#FFEBF6;border:none;"><br/>
        <input id="click" onclick="Redirect()" type="button" value="Find Cards" style="width:200px; height:45px; margin-top:5px;background-color: #2832C2;border:#415BA4;color:#ffffff; font-weight:bold;"/>
    </td>

    </tr>
</table>

The Find Cards button is not clickable. What is wrong with this code?

2

Answers


  1. onclick of button this function will opens multiple pages

    function Redirect() {
        window.open('url here', '_blank'); 
        window.open('url here', '_blank');
      }
    
    Login or Signup to reply.
  2. for this you have to make code with condition statement and when 2 value combination match it will open your desire url

    try out this code

    function Redirect(e) {
      e.preventDefault()
      var value1 =$('#selectBox1').val();
      var value2 = $('#selectBox2').val();
      if(value1 == "your value" && value2 == "your value"){
        window.open('your url', '_blank');
         
      }
      // repeate this if with your all combination of your value  and chage url 
      
      } 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search