1
I have a form with a check that the marked shows a div with an input with the name of BancoFinanc, the user can fill in this input normally, but would like when unchecking the input, if filled in by the user, to be cleaned.
What I have and what I’ve tried to do is this, but to no avail:
$(function () {
    $("#chkFinanciamento").click(function () {
        if ($(this).is(":checked")) {
            $("#dvFinanciamento").show();
        } else {
            $("#dvFinanciamento").hide();
            // LIMPA VARIÁVEL
            $("#dvFinanciamento > :BancoFinanc").val();         
        }
    });
});
And also this:
$(function () {
    $("#chkFinanciamento").click(function () {
        if ($(this).is(":checked")) {
            $("#dvFinanciamento").show();
        } else {
            $("#dvFinanciamento").hide();
            // LIMPA VARIÁVEL
            $("#BancoFinanc").attr("value","");     
        }
    });
});
						
Thanks @Allan Andrade, solved my problem.
– adventistapr