Попытки изменить HREF ссылки в заявлении, в зависимости от которой радиокнопка выбранаИзменения HREF значения при выборе радиокнопки с помощью переключателя заявления
<ul class="size_selector">
<li class="top"><input type="radio" class="radioselect" name="id" id="test1" value="test1" /><label for="test1">1</label></li>
<li class="top"><input type="radio" class="radioselect" name="id" id="test2" value="test2"/> <label for="test2">2</label></li>
<li class="top"><input type="radio" class="radioselect" name="id" id="test3" value="test3"/> <label for="test3">3</label></li>
<li class="top"><input type="radio" class="radioselect" name="id" id="test4" value="test4"/> <label for="test4">4</label></li>
</ul>
<a id="shopCart" href="#">
Take me to your leader
</a>
Jquery
$("input[type='radio']").change(function(){
switch($(this).val()) {
case "test1" :
document.getElementById("shopCart").href="http://yahoo.com";
break;
case "test2" :
document.getElementById("shopCart").href="http://bing.com";
break;
case "test3" :
document.getElementById("shopCart").href="http://google.com";
break;
case "test4" : document.getElementById("shopCart").href="http://stackoverflow.com";
break;
};
});
http://codepen.io/homogenizer/pen/xOrzgZ
Ха-ха. Спасибо!! – Sean