I need to implement such a function. At the last stage on the checkout page, when the entire order is already visible and the delivery selection method occurs, there is a choice of delivery method implemented by radiobutton http://joxi.ru/DrlzvbXi6qo52P How can I make it so that when choosing a certain delivery method - would the input field appear?
1 answer
The simplest example
HTML
<form action=""> <input type="radio" name="typeDelivery" value="1"> Доставка 1<br> <input type="radio" name="typeDelivery" value="2"> Доставка 2<br> <input type="radio" name="typeDelivery" value="3">Доставка 3 <input id="address" type="text" name="address" value="" style="display:none"> </form> Js
(function () { "use strict" function _deliveryAddress () { $(document).ready(function() { $("input[name=typeDelivery]:radio").change(function () { console.log(); if($(this).val() == 2) { $('#address').css('display', 'block'); } else { $('#address').css('display', 'none'); } }); }); } return { delivery: _deliveryAddress() } }()) |