Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9133057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:25:17+00:00 2026-06-17T08:25:17+00:00

I have 2 radiobuttons (A,B) acting as shipping options and one input textfield for

  • 0

I have 2 radiobuttons (A,B) acting as shipping options and one input textfield for inputting phone numbers.
After selecting A, I need to show custom help text inside the text area (‘phone required’). If button B is selected – there should be no help text.

If A is selected, helptext should be removed after user clicks inside textfield and types the number.
If any option is selected and the textfield is filled. It should stay this way.

My code works except the help text is not removed if user selects A option and after B option without typing anything.

$(document).ready(function () {
  $('input#edit-quote-option-flatrate-3---0').change(function () {
    if ($('input#edit-quote-option-flatrate-3---0').is(":checked")) {


  $('.default').each(function () {
    var defaultVal = ('tel');
    $(this).focus(function () {
      if ($(this).val() == defaultVal) {
        $(this).removeClass('active').val('');
      }
    })
      .blur(function () {
      if ($(this).val() == '') {
        $(this).addClass('active').val(defaultVal);
      }
    })
      .blur().addClass('active');
  });
    } else {

        $('.default').removeClass('active').val('');

    }
  });
});

full code is here http://jsfiddle.net/NKcFs/2/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:25:18+00:00Added an answer on June 17, 2026 at 8:25 am

    Try adding a change handler for the second option that sets the value to blank… thats what you wanted to do, right?

       $('#edit-quote-option-flatrate-3---1').change(function(){  
        $('.default').each(function () {
          if($(this).val() == 'tel'){ // if the user didn't change it, clear the field
              $(this).val('');
          }
        });
      });
    

    Fiddle here: http://jsfiddle.net/gcmDu/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a number of radiobuttons where only one should be
I have 2 input textfields and 4 radiobuttons. With a click on the submit
i have 3 radio buttons.what i need to do is that when one radio
I have 7 RadioButtons on a Form 3 of them belongs one group and
I have the following radiobuttons rendered in MVC : <div class=radio id=ModelViewAd.TypeOfAd> <input checked=checked
I have a problem checking/selecting radiobuttons, checkboxes and list styles at runtime using jQuery/jQuery
I have a groupBox that I have put three RadioButtons and one TextBox in
I have multiple panels and on each panel I have 2 RadioButtons. I need
I need your help to solve my layout problem.. I have 4 RadioButtons, they
I have radiobuttons with data_bind = checked binding. I need to call custom function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.