Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are binding something to the <code>click</code> event of a button. You probably want to bind it to the <code>submit</code> event of the form. Besides that, you misspelled <code>input.sumbit-button</code> in your selector.</p> <p><strong>EDIT</strong>: <a href="http://jsbin.com/izixa" rel="nofollow noreferrer">Here</a> is a working version of what you want. Your errors were:</p> <ul> <li>You were probably not wrapping your code around <code>document.ready</code>. 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 <code>document.ready</code> event takes care of that by firing as soon as the DOM is fully loaded.</li> <li>You had a missing closing <code>)</code> right before <code>.attr</code>. You should probably look into tools like <a href="http://getfirebug.com/" rel="nofollow noreferrer">FireBug</a> to debug your javascript, as it is trivial to find these kind of things with it.</li> <li>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 <a href="http://docs.jquery.com/Selectors/checked" rel="nofollow noreferrer"><code>:checked</code></a> one.</li> </ul> <p>So, the working code:</p> <pre><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?"); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload