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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:41:36+00:00 2026-05-11T12:41:36+00:00

I have two radio buttons like so <input type=radio name=rush value=yes /> <input type=radio

  • 0

I have two radio buttons like so

<input type='radio' name='rush' value='yes' /> <input type='radio' name='rush' value='no' checked='checked' /> 

What I want to do is when the form submit button is clicked, check if ‘yes’ is selected.

If it is, show a javascript confirm dialog

I’ve gotten this far, but am stuck, any help would be appreciated.

$('form.shipping').submit(function() {      if($('input[name='rush']'.attr('value') === 'yes')     {         if (confirm('Rush orders are subject to an upcharge. (Just wanted to make sure you read the note). Is this ok?'))         {             return true;         }         else         {             return false;         }     }  }); 
  • 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. 2026-05-11T12:41:36+00:00Added an answer on May 11, 2026 at 12:41 pm

    You are binding something to the click event of a button. You probably want to bind it to the submit event of the form. Besides that, you misspelled input.sumbit-button in your selector.

    EDIT: Here is a working version of what you want. Your errors were:

    • You were probably not wrapping your code around document.ready. This is important if your script is included at the top of the page, as anything you write that is not wrapped in this event will execute before the DOM elements are created. So you would be binding events to nothing. The document.ready event takes care of that by firing as soon as the DOM is fully loaded.
    • You had a missing closing ) right before .attr. You should probably look into tools like FireBug to debug your javascript, as it is trivial to find these kind of things with it.
    • You were checking the value of the radio button, but it was always evaluating to true because you need to filter it out to only get the :checked one.

    So, the working code:

    $(document).ready(function() {     $('form.shipping').submit(function() {         if($('input[name='rush']').is(':checked')) {             return confirm('Rush orders are subject to an upcharge.             (Just wanted to make sure you read the note). Is this ok?');         }     }); }); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example I have the following radio buttons: <input type=radio name=hand id='hand_left' checked value=L>
I have a form with the following... <dt class=idx><span>Sex:</span></dt><dl><fieldset>Male<input type=radio name=Sex value=Male checked>Female<input type=radio
I have a radio button like below Apple <input type=radio id=one name=apple data-price=10 value=light/>
I have the following piece of code: <form [attributes]> <input class=bound type=radio name=radioGroup value=1
I have the following scenario: <span> <input checked=checked id=rad name=rad type=radio value=1 /> Opt1
Code: <input type=radio value=x name=a />One<br /> <input type=radio value=y name=b />Two<br /> ....
I have a div which contains several radio buttons, like this: <div name=type id=type>
I have a form with two radio buttons, Yes and No, that toggles visibility
I have the following HTML: <input type=radio name=beds value=1 />1+ <input type=radio name=beds value=2
In main.xml I would like to have a spinner1 with two radio buttons and

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.