JSFiddle - React, Tailwind, and code Playground

by Adriano Avelino

HTML

Tipo 1<input type="checkbox" name="tipo1" id="" value="tipo1"><input type="text" disabled></input><br>
        Tipo 2<input type="checkbox" name="tipo2" id="" value="tipo2"><input type="text" disabled></input><br>

JavaScript

$('input[type=text]').hide();
    $('input').change(function(){
        if(this.checked){
          var valor = $(this).val();
          
          $(this).next().val(valor).show();         
        }else{
            
            $(this).next().val('').hide();
        }

    });