Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!