0

Im using a form:

<form class="sortform" action="" method="get">
<select id="custom-search-filter" class="filter">
<option class="custom-search-order" value="ASC">Ascending</option>
<option class="custom-search-order" value="DESC">Descending</option>
</select>
</form>

to submit another form:

jQuery('select#custom-search-filter').change(function() {

    var order = jQuery(this).val();

    jQuery("div#custom-search-wrap #searchform input#order").val(order);

    jQuery('div#custom-search-wrap #searchform').submit();

});

The other form:

<form role="search" method="get" id="searchform" action="http://mysite.lh/">

...

</form>

Form above is working, but is not working when the other select from the other form change.

But this is not working on IE7? Any help is welcome.

Thanks.

3
  • Can you post the HTML for the other form as well? Dec 7, 2011 at 10:54
  • Guess: Both your forms have the same ID?
    – karim79
    Dec 7, 2011 at 10:55
  • now i added the other form piece of code Dec 7, 2011 at 11:03

1 Answer 1

1

I looked at your code and i cant find a form wich matches your

div#custom-search-wrap #searchform

selector.

This will work...

$(function() {
  alert($('div#custom-search-wrap #searchform').length) // 0 nothing found
  alert($(".sortform").length) // 1 form found
})

Update

You said that the form comes from another piece of code.

Please check your selector like i done it and compare the results in IE with firefox, chrome or etc.

hope this helps

1
  • Now works great when I added names and not just only ids to forms and to select field. Thanks man. Dec 7, 2011 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.