Skip to main content

Bug Tracker

Side navigation

#3575 closed feature (invalid)

Opened November 05, 2008 12:54PM UTC

Closed January 31, 2009 06:07PM UTC

select event for html select element

Reported by: stasikom Owned by: brandon
Priority: minor Milestone: 1.3
Component: event Version: 1.2.6
Keywords: Cc: stasikom
Blocked by: Blocking:
Description

Binding actions to a select element with dynamic option ammount is quite hard to implement. You never know, if there is going to be 1 or more options.

I've been binding to the "change" event, which doesn't fire on one-option selects - effecting in hindering the desired behaviour.

Another problem is, when you have a select with options > 1, it tends to remember what has been selected. If further document behaviour depends on that selection, and the user wishes to keep it (not change it) - he can't fire the "change" event without in fact changing the selection, then selecting the desired option once again. It kind of breaks usability.

A "select"-like event for select elements would really help here. It should get fired once an option is clicked. Unfortunately, binding actions to "click" on option elements fails in IE.

Attachments (1)
  • index.html (5.6 KB) - added by stasikom December 03, 2008 03:44PM UTC.

    test case

Change History (2)

Changed November 06, 2008 09:46PM UTC by flesler comment:1

cc: → stasikom
need: ReviewTest Case

The change event is THE way of doing that, it's perfectly usable.

Some browser do remember last selected option, what's the problem with that ?

Can you make a test case so I understand the situation ?

Changed January 31, 2009 06:07PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

I looked at the test case. The decision on whether to show the next step should depend on whether the current step is displaying the non-default selection, not simply whether the change event has fired. For example, if the user sets the value back to "choose something" in step 1, the value for step 2 is still showing even though it's not appropriate anymore.

In the

.ready()
handler you can use the pattern
$("select").change(function(){ ... }).trigger("change")
to make sure the values are set correctly when the page is reloaded.