Please visit my new campsite listing site ukcampingmap.co.uk


jNice styled forms fix for select change event

I’m working so can’t be bothered writing out in full, but in case anyone else spends hours trying to work out why their fancy looking jQuery select boxes don’t seem to have a change event, add this line near the end of the selectUpdate function, just before return false;

$select.trigger(“change”);

No related posts.

Tags: , , , ,

9 Responses to “jNice styled forms fix for select change event”

  1. Small_Bird says:

    a THANKS like THAT! :) for you post

  2. I’ll try it… spend a lot of time searching how to fix this.

    Thanks friend

  3. Pedro says:

    … and of course it works ! Thanks

  4. Kirill says:

    Thank You!!! It work :)

  5. ranganath says:

    hi,

    i have pasted that line before returen false but the style is gone please help me in this

  6. umpirsky says:

    Most ridiculous is that they have part of code which should fire it /* Fire the onchange event */
    if ($select[0].selectedIndex != $(this).attr(‘index’) && $select[0].onchange) { $select[0].selectedIndex = $(this).attr(‘index’); $select[0].onchange(); }

  7. Good, but this fires even when the select doesn’t change on every click. Replacing the code mentioned by umpirsky with prevents the default from firing the change event and only fires when the value actually changes. Thanks for the pointer!

    if($select[0].selectedIndex != $(this).attr(‘index’)){
    $select.trigger(‘change’);
    }

  8. Good, but this fires even when the select doesn\’t change on every click. Replacing the code mentioned by umpirsky with prevents the default from firing the change event and only fires when the value actually changes. Thanks for the pointer!

    if($select[0].selectedIndex != $(this).attr(\’index\’)){
    $select.trigger(\’change\’);
    }

  9. Luka says:

    I don’t know what I love more about this post: its simplicity or the geniousness :) Thanks ;)

Leave a Reply

Security Code: