Skip to content

Instantly share code, notes, and snippets.

View dropdowns.js
$(document).click(function(e) {
if ($('.toggle').length > 0){
var target = target.closest('.toggle');
if (target.hasClass('menuOn')){
} else {
$('.dropdown .menu').hide();
lou / uninstall all gems
Created Jul 7, 2011
uninstall all gems
View uninstall all gems
for i in `gem list --no-versions`; do gem uninstall -Ia $i; done
lou / multiselect-collapse
Created Aug 24, 2011
multiselect optgroup collapsable
View multiselect-collapse
$('#ms-YOUR_SELECT_ID .ms-selectable').find('').hide();
lou / searchable-multiselect.js
Created Sep 14, 2011
searchable multiselect
View searchable-multiselect.js
selectableHeader : '<input type="text" id="search" />'
$('input#search').quicksearch('#ms-searchable-form .ms-selectable li');
lou / deactivate-selected-elem.js
Created Sep 28, 2011
deactivate selected element in multiselect
View deactivate-selected-elem.js
afterSelect: function(value){
if (1 == 1){
var selectedLi = $('.ms-elem-selected[ms-value="'+value+'"]').first();
lou / searchable.js
Created Apr 3, 2012
multiselect searchable
View searchable.js
selectableHeader : '<input type="text" id="search" autocomplete = "off" />'
$('input#search').quicksearch('#ms-searchable-form .ms-selectable li');
lou / searchable.hmtl
Created Apr 3, 2012
searchable multiselect
View searchable.hmtl
<select name="countries[]" multiple="multiple" id="searchable-select">
<option value="fr" selected="selected">France</option>
<option value="ca">Canada</option>
<option value="ar">Argentina</option>
<option value="pt">Portugal</option>
<option value="us">United States</option>
<option value="gb">United Kingdom</option>
<option value="au">Australia</option>
<option value="ao">Angola</option>
View multiselect-usage.js
afterSelect: function(value, text){}, // Function to call after one item is selected
afterDeselect: function(value, text){}, // Function to call after one item is deselected
selectableHeader: null, // Text or HTML to display on the selectable container
selectedHeader: null, // Text or HTML to display on the selected container
disabledClass: 'disabled' // CSS class for disabled items
lou / multiselect-usage.html
Created Apr 22, 2012
multiselect usage html
View multiselect-usage.html
<select multiple="multiple" id="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
lou / multiselect-callbacks.js
Created Apr 22, 2012
multiselect callbacks
View multiselect-callbacks.js
// You must init the multiple select with $('#my-select').multiSelect() before calling one of the following methods
$('#countries').multiSelect('select', 'value'); // Select the item with the value given in parameter
$('#countries').multiSelect('deselect', 'value'); // Deselect the item with the value given in parameter
$('#countries').multiSelect('select_all', true); // Select all elements. If parameter visible set to true, it will select only visible items. Otherwise it will also select hidden items.
$('#countries').multiSelect('deselect_all'); // Deselect all items previously selected