Change button link according to select

-1

I am developing a flat table, where the values of these plans vary depending on the options selected in (there are 4 selection options).

This part of changing the plan value according to the options you have chosen has already been resolved, however, the "JOIN" buttons on the plans do not vary according to the options you selected. (these links will direct you to purchase this subscription plan, as each combination of the selected options is a value, I would like the button links to vary also according to the options selected.)

Follow the link in the table: link

    
asked by anonymous 22.05.2017 / 19:10

1 answer

1

To change the link according to the selected option, you could do in several ways, among them, the form shown below. I took the volume field as an example to demonstrate how to do it:

   jQuery(function($){
        $('#volume, #visitas').change(function(){
		var volume = $('#volume').val();
		var visitas = $('#visitas').val();
		if (volume == "50" && visitas == "4") {
	            $('.Linkbotao').attr('href', 'http://www.google.com.br');
		}
		else if (volume == "80" && visitas == "4") {
		    $('.Linkbotao').attr('href', 'http://www.uol.com.br');
		}
		else if (volume == "50" && visitas == "8") {
		    $('.Linkbotao').attr('href', 'http://www.yahoo.com.br');
		}
	});
});
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script><form>Volume<selectname="volume" id="volume">
	<option value="" selected>Selecione</option>
	<option value="50">50</option>
	<option value="80">80</option>
     </select>
     <br>
     <br>
     Visitas <select name="visitas" id="visitas">
    	<option value="" selected>Selecione</option>
    	<option value="4">4</option>
    	<option value="8">8</option>
     </select>
     <br>
     <br>
     <a href="#" class="Linkbotao" target="_blank">
       <input type="button" name="aderir" id="aderir" value="aderir"> 
     </a>
</form>
    
23.05.2017 / 19:41