Side navigation
#4392 closed bug (invalid)
Opened March 20, 2009 01:03PM UTC
Closed August 07, 2009 04:30PM UTC
.val('') does not deselect
Reported by: | cdude | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | 1.4 |
Component: | unfiled | Version: | 1.3.2 |
Keywords: | select | Cc: | |
Blocked by: | Blocking: |
Description
To clear a form I set "myform" attributes and use
$([myform]).val("").
This does not work for selects. The code tries something like this:
option.selected = (option.value == "");
(or something similar). Actually,
option.selected = false;
does not do anything in IE! It would work as expected if
select.selectedIndex = -1;
came first.
BTW, I can't find the "select" selector in your online docs.
Can you attach a test case that shows exactly what the code does?
Where does the
variable come from?The "select" selector is
since it's the name of the HTML element.