Skip to content

Instantly share code, notes, and snippets.

@nathanpalmer
Created August 1, 2011 14:00
Show Gist options
  • Save nathanpalmer/1118170 to your computer and use it in GitHub Desktop.
Save nathanpalmer/1118170 to your computer and use it in GitHub Desktop.
<form data-bind="submit:addItem">
Add item: <input type="text" data-bind='value:itemToAdd, valueUpdate: "afterkeydown"' />
<button type="submit" data-bind="enable: itemToAdd.length > 0">Add</button>
</form>
<p>Your values:</p>
<select multiple="multiple" height="5" data-bind="options:allItems, selectedOptions:selectedItems"> </select>
<div>
<button data-bind="click: removeSelected, enable: selectedItems.length > 0">Remove</button>
<button data-bind="click: sort, enable: allItems.length > 1">Sort</button>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment