<div class="container"> <script> $('#selk').on('change',function(){ var v = $(this).val(); if(v == 'MX'){ $('#MX').show(); $('#SRV').hide(); } if (v =='SRV'){ $('#SRV').show(); $('#MX').hide(); } }); </script> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading">Добавление DNS записи</div> <div class="panel-body"> <form method = "POST"> {{csrf_field() }} <label> Хост <input name = "host"> </label> <br> <label> Контент <input name ="content"> </label> <br> <!--Если в селекте выбрано значение 'MX',то поле Приоритет отображается, а если значение другое, то не отображается--> <select name="type" id='selk'> <option value="A">A</option> <option value="MX">MX</option> <option value = "SRV">SRV</option> </select> <div id="MX" style="display:none;"> <label> Priority <input name = "priority"> </label> </div> <div id = "SRV" style = "display:none;"> <label> Priority <input name = "priority"> </label> <br> <label> Weight <input name = "weight"> </label> <br> <label> Port <input name = "port"> </label> <br> <label> Proto <input name = "proto"> </label> <br> <label> Target <input name = "target"> </label> </div> <br> <input type = "submit" value = "Add"> </form>