Ca-Phun Ung

Freelance web developer and Internet consultant at Yelotofu.
Categories
- Accessibility (6)
- Browser Testing (5)
- CSS (11)
- Django (3)
- Events (5)
- Hong Kong (3)
- JavaScript (18)
- Labs (2)
- Optimisation (2)
- PHP (8)
- Ramblings (12)
- Reviews (6)
- Ruby on Rails (4)
- Tools (5)
- Web Standards (10)
- WiFi (3)
Oct22
Tip: getting values from an options list
So, if you’ve ever converted an options list into a single array of values you might have intuitively done this: var select = $(‘#mySelectElement’)[0]; var values = new Array(); for (var i=0; i < select.length; i++) { values.push(select.options[i].value); } Pretty boring aye? There is a snazzier (is that a word?) alternative, which is to use [...]