0
function myFunction() {
var cor = document.getElementById("Cor").value;
var tamanho = document.getElementById("Tamanho").value;
console.log(cor)
console.log(tamanho)
if (cor === "Luz Fria" && tamanho === "3m X 2m") {
document.getElementById("Botao-Compra").href = "https://luzfria.com";
}
if (cor === "Luz Quente" && tamanho === "3m X 2m") {
document.getElementById("Botao-Compra").href = "https://luzquente.com";
}
}
a:link,
a:visited {
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
<p>Escolha seu kit:</p>
<select id="Cor" onchange="myFunction()">
<option value="Luz Fria">Luz Fria
<option value="Luz Quente">Luz Quente
</select>
<select id="Tamanho" onchange="myFunction()">
<option value="3m X 2m">3m X 2m
</select>
<a id="Botao-Compra" href="https://luzfria.com">Quero comprar!</a>
Good morning, I am a very lay person in the subject and I have a problem that I can not solve, I even posted a question here, but because I do not understand very well, they have just deactivated the question, so I’m trying again, this time explaining a little better, before there was no time, because they deactivated.
I need that by clicking the button (I want to buy!) it goes to a URL if the client chooses a color and to another URL if the client chooses the other color option, for example, if the client selects the cold light, it goes to http://luzfria.com if the customer selects hot light, it goes to http://luzquente.com.
Our payment platform has a link to each combination when choosing a product. If you choose the color "Warm Light" and size "3Mx2M", when you click the buy button, it goes to the hot light payment URL. If you choose the color "cold light" and size 3Mx2M, when you click the buy button, it goes to the cold light payment URL. It turns out that by clicking the buy button, it always takes me to the same link, in case the link inserted in the buy button: https://luzquente.com
I apologize if I didn’t explain myself properly, if you’re a complete layperson, I’ve searched the Internet for several days, but I haven’t.. found with jQuery, but I don’t know how to insert this my site, or how it works.
Hello Thayná, the other question has not been deactivated, the blue box above has the instructions on how to solve, it is not allowed to duplicate the question to get around the problem, just edit the original question and follow the tips already mentioned by the other colleague: https://answall.com/questions/478311/galera-preciso-que-meu-bot%C3%a3o-v%C3%a1-para-um-link-em-fun%C3%A7%C3%a3o-das-Vari%C3%a1veis-luz-quen#89comment6631_478311 - Thank you for understanding.
– Guilherme Nascimento