gawel / pyquery

A jquery-like library for python
http://pyquery.rtfd.org/
Other
2.3k stars 182 forks source link

val() should handle setting array of strings and select-multiple elements #185

Closed whybin closed 6 years ago

whybin commented 6 years ago

As per the jQuery API, val() handles select elements with the multiple attribute by setting and getting arrays of strings, toggling the selection of multiple options. For non-select elements, val() concatenates array items.

Additionally, setting the value for non-multiple select elements now only activates the first matching option, whereas previously all options with the duplicate value would be selected.

Added docs and tests, which have passed.