Modify ↓
Ticket #6606 (closed bug: worksforme)
jQuery(selector).val("") does not set value=""
| Reported by: | seasong | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | 1.4.3 | |
| Component: | manipulation | Version: | 1.4.2 |
| Keywords: | empty string false val | Cc: | |
| Blocking: | Blocked by: |
Description
jQuery(selector).val() returns the value of the element in question, and does not alter the value at all, as it should.
jQuery(selector).val("") does exactly the same thing, however - you might as well not include the quote marks.
I have been getting around this with:
jQuery(selector).get(0).value = ""
While that *works*, I would prefer to not have to jump out of the jQuery object (and thus the jQuery mindset) to get something so basic done.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This works for me, if it doesn't work for you please submit a test case.