Skip to main content

Bug Tracker

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.

Attachments (0)
Change History (2)

Changed March 21, 2009 01:16AM UTC by dmethvin comment:1

The code tries something like this

Can you attach a test case that shows exactly what the code does?

Actually,
option.selected = false;
does not do anything in IE!

Where does the

option
variable come from?

BTW, I can't find the "select" selector in your online docs.

The "select" selector is

$("select")
since it's the name of the HTML element.

Changed August 07, 2009 04:30PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

Closed-inactive.