lgt
lgt

Reputation: 1034

jQuery's submit() won't get fired

I have the following code but it doesn't work I assume that the problem is around my function declaration but not sure how to debug it. Any help would be welcome.

<script type="text/javascript">
$(function(){   
if ($('select#prod_category').val() == ''){
          $('select#prod_group').hide();
          }
if ($('select#prod_group').val() == ''){
          $('select#product').hide();
          } 
$("form#g_search select").change(function(){
    $("div#gutschein_filter form#g_search").submit(function(){
        event.preventDefault();
        window.location.href = "/folder/" +
        encodeURI($("#prod_category").val()) + "/" +
        encodeURI($("#prod_group").val());
    });


  });
});
</script>

Upvotes: 0

Views: 48

Answers (1)

thecodeparadox
thecodeparadox

Reputation: 87073

$("div#gutschein_filter form#g_search").submit(function( event ){                                                     
    event.preventDefault();
    window.location.href = "/folder/" +
    encodeURI($("#prod_category").val()) + "/" +
    encodeURI($("#prod_group").val());
});

I've found one problem in your code. Missing of event parameter to submit callback function.

Use firebug or such like debuggers to get errors. Here is about firebug for JavaScript.

Upvotes: 3

Related Questions