Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda