There is a normal input
<input type="text" name="bin" placeholder="" class="order_input"> There are radio buttons, where when you click on one, this Input is visible, when you click on the second, it is hidden.
<script> $(document).ready(function(){ $( ".individual" ).click(function() { $( ".requi" ).slideUp(500); }); $( ".legal" ).click(function() { $( ".requi" ).slideDown(500); }); }); </script> How to make it so that when you clicked, the required attribute was added to the input and was also removed when you clicked on another radio button.