SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery .submit running twice?

    My eyes must be getting bad because I can not for the life of me see why the submit code on this thing is happening twice

    Code JavaScript:
    <form method='post' action='index.php' id='e_form'>
      <p><label for='e_type_g'><input type='radio' name='e_type' id='e_type_g' value='g' /> Guitar Contest</label></p>
      <p><label for='e_type_r'><input type='radio' name='e_type' id='e_type_r' value='r' /> Rhythm Contest</label></p>
      <fieldset id='e_amount' style='display: none; width: 150px; margin-left: 10px;'>
        <legend style='padding: 0 5px; font-weight: bold;'>Entry Type</legend>
          <p><label for='e_1'><input type='radio' name='num_entries' id='e_1' value='1' /> Solo ($25 fee)</label></p>
          <p><label for='e_2'><input type='radio' name='num_entries' id='e_2' value='2' /> Duo ($50 fee)</label></p>
          <p><label for='e_3'><input type='radio' name='num_entries' id='e_3' value='3' /> Trio ($75 fee)</label></p>
      </fieldset>
      <p><input type='submit' value='continue' class='button' /></p>
    </form>
    <script type='text/javascript'>
     
    $(document).ready(function()	{
     
      $('#e_type_r').click(function()	{
        $('#e_amount').show();
      });
     
      $('#e_type_g').click(function()	 {
        $('#e_amount').hide();
        $('input[name=num_entries]').attr('checked', false);
      });
     
      $('#e_form').submit(function(event)	 {
     
        event.preventDefault();
        alert($('#e_type_g').attr('checked'));
     
      });
     
    });
     
    </script>

    The alert alert($('#e_type_g').attr('checked')); shows twice

    Not seeing any errors in Firebug either

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind, it was jscrollpane causing it, no idea why but it is the cause (the form is in a div that uses a scroll bar and jscrollpane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •