Hi All,

I'm having problems getting a simple poll to work correctly in IE6 -
unfortunatey the form always trys to submit, ignoring the jQuery
script below:

$(function() {
  $('.error').hide();


  $("#button").click(function() {
    $('.error').hide();

          var pollid = $('#pollid').val();

                var ansa;
                var ansb;

                if ($('#ansa:checked').val() == null) {
                        ansa = "";
                        poll = "ansB";
                }

                if ($('#ansb:checked').val() == null) {
                        ansb = "";
                        poll = "ansA";
                }
                /*
                if (ansa != "" || ansa != "undefined")
                {
                poll = "ansA";
                }

                if (ansb != "" || ansb != "undefined")
                {
                poll = "ansB";
                }
                */
                var dataString = 'ans='+ poll + '&pollid=' + pollid;;
                //alert (dataString);return false;

                $.ajax({
      type: "POST",
      url: "poll-process.htm",
          cache: false,
      data: dataString,
      success: function(html) {

        $('.poll-container').html("<div id='message'></div>");
        $('#message').append(html)
        .hide()
        .fadeIn(1500, function() {
          $('#message');
        });
      }
     });
    return false;
        });
});

The HTML is as follows:

<form id="poll" name="vote" action="" method="get">
<h3>What's the best way out of the recession?</h3>
<p><input type="hidden" id="pollid" name="pollid" value="59762" />
<input type="radio" name="poll" id="ansa" value="ansA">Spend more
money</input><br />
<input type="radio" name="poll" id="ansb" value="ansB">Cut down on
expenses</input><br />
<input id="button" class="button" type="submit" value="Vote" /></p>
</form>

I'm quite new to jQuery so any help would be greatly appreciated,
thanks in advance.

Reply via email to