Skip to content

Instantly share code, notes, and snippets.

@jacekd
Created December 2, 2012 19:32
Show Gist options
  • Save jacekd/4190567 to your computer and use it in GitHub Desktop.
Save jacekd/4190567 to your computer and use it in GitHub Desktop.
A CodePen by Jacek Dominiak.
<select multiple='multiple' id="select">
<option>one</option>
<option>two</option>
<option>three</option>
<option>four</option>
</select>
<div class="button" id="up"></div>
<div class="button" id="down"></div>
(function(){
$(".button").click(function(){
var option = $("#select option:selected"),
this = $(this);
if(option.length) {
(this.attr("id") == "up") ?
option.first().prev().before(option) :
option.last().next().after(option);
}
});
})();
.button {
width: 0;
hegith: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
margin: 10px;
arrow: pointer;
}
#up {
border-bottom: 5px solid #111;
}
#down {
border-top: 5px solid #111;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment