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 977777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:57:22+00:00 2026-05-16T03:57:22+00:00

I have a radio button set called pick_up_point. There are 3 options and clicking

  • 0

I have a radio button set called “pick_up_point”. There are 3 options and clicking on an option will display a set of input fields relevant to the option.

Now by default when the user clicks on an option I run the change() function which will run a function called “clearInputFields” – which as you might guess will clear out any text entered in the input fields.

$("input[name='pick_up_point']").change(function()
{
 clearInputFields(); 
});

Now I have tried extending this so that a prompt is displayed to the user to let them know that the input fields will be cleared:

$("input[name='pick_up_point']").click(function(event)
{
 if(confirm('Address details will be cleared. Continue?'))
 {
  return true;
 }
 else
 {
  return false;
 }
});

The ‘click’ function is before the ‘change’ function.

This works “OK” in Firefox and does not work properly in IE.

In Firefox the radio button gets selected and the prompt is displayed, and clicking on the Cancel button will go back to the previous option with all values retained.

In IE the radio button gets selected and the prompt is displayed but the values get cleared out. If you click Cancel then no radio button is selected.

The way I would like this to work is if you click another radio button it should not select it unless you click OK on the prompt. If you click Cancel the values should be retained.

  • 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-05-16T03:57:23+00:00Added an answer on May 16, 2026 at 3:57 am

    In IE, the change event on checkboxes and radio buttons doesn’t fire immediately, but only after the field has been unfocused. In this way it behaves like text input boxes.

    jQuery monkeys about with the change event quite significantly, in a way that hides this behaviour from you. However it is unable to accurately reproduce the behaviour of other browsers in IE, so in some cases it will trigger change in response to interaction with an element even when another click event handler tries to preventDefault.

    Another problem: in IE, if you return false from click on a radio button, the new radio button won’t get checked, but the previous button will still lose its checkedness, leaving you with no radios checked!

    So you’ll probably have to do some kind of annoying state-tracking, and manually put the radio buttons back to their old state when the confirm is refused. eg.:

    var currentradio= $("input[name='pick_up_point']:checked")[0];
    $("input[name='pick_up_point']").change(function(event) {
        var newradio= $("input[name='pick_up_point']:checked")[0];
    
        if (newradio===currentradio)
            return;
        if (confirm('Address details will be cleared. Continue?')) {
            clearInputFields();
            currentradio= newradio;
        } else {
            currentradio.checked= true;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jquery trigger - ‘change’ function I have a radio button set called
I have a radio button named Choose with the options yes and no. If
I have a radiobutton set called 'daypattern'. Clicking on it should enable the checked
I have a set of radio button groups. How can I get which is
I have a form that has a radio button set. When the page loads,
I have a set of radio button which i want to use as filter
I'm having trouble submitting radio button values. I have two radio buttons set up
I ask this because I have a form with a radio button set to
i have four radio buttons , and i want to set a text for
I have a set of radio buttons in my page. On the change I

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.