Skip to content

Instantly share code, notes, and snippets.

View MartinL83's full-sized avatar
🤷‍♂️
wat

Martin Lindgren MartinL83

🤷‍♂️
wat
View GitHub Profile
@MartinL83
MartinL83 / bootstrap-confirm.js
Last active August 29, 2015 14:00
Simple confirm modal on inputs / links / whatever trough data-attr. Will launch a (Twitter) Bootstrap modal on elements that have a data-confirm-action="confirm". Some settings available. **Needs loads of improvements**
// Confirmation modal on elements that have 'confirm' class.
// Will launch a modal and ask for confirmation.
// data-confirm-action="confirm" - Will enable the confirm modal
// data-confirm-title="" - Custom title, optional
// data-confirm-text="" - Custom modal text, optional.
;(function ( $, window, document, undefined ) {
// Create the defaults once
var pluginName = "confirmAction",
defaults = {
@MartinL83
MartinL83 / filterSelectByParent.js
Last active August 29, 2015 13:58
Small jQuery plugin to filter a child <select> based on a parent <select>.
/*
Based on: http://stackoverflow.com/a/878331
Filter child select from selected parent select option.
Will look for parent (options) value in child data-parent"XX".
<select id="parent">
<option value="1">Group 1</option>
<option value="2">Group 2</option>