Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Clear textbox after selection of different radio button in jQuery

I'm adding Radio button dynamically

 function RadioButton() {
    $.ajax({
        type: "POST",
        url: "VPATransaction.aspx/SetRadioButton",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: function (result) {
            var jsonData = eval(result.d);


            $.each(result.d.Table, function (index, value) {


                $('#rb').append("<ul><li><input type='radio' name='radio' id='rbs_' value=" + value.PurposeTransid + " style><span id='tf' name='TextFiled'>" + value.Purpose_trans_name + " </span></li></ul>");
                $("#rbs_").click(function () {
                    $("#tf0").val("");  
                });

            });
        }
    })
}

**TextBox is also  adding dynamically**


    
    function Textbox() {
        $("#add")
            .append($("    <div class='col-md-12'>")
                .append($(" <input type='text' name='TextField' id='TF" + Tcount + "'class='col-sm-12 col-md-12 col-xs-12' />")
    
    
                    .append($("</div>")
                       
                    )
    
                )
            );
        Tcount++;


}

because on button click I'm adding more textBox

Goal is to clear value of textbox when i click on other radio button I have used .val and .attr but nothing happend

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here you did not use the click function while using the textbox dynamic function. So you can use like following method,

$(document).ready(RadioButton(){
        $('#btnClear').click(RadioButton(){             
            if(confirm("Want to clear?")){
            
                $('#form1 input[type="text"]').val('');
                
                $('#form1 #txtAddress').val('');

Here when you click the Radio button the function will automatically clear the text box after you click yes on the dialog box appears.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda