UNPKG

selectric

Version:

Fast, simple and light jQuery plugin to customize HTML selects

2 lines 927 B
/*! Selectric Placeholder ϟ v0.2.0 (2017-08-22) - git.io/tjl9sQ - Copyright (c) 2017 Leonardo Santos - MIT License */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,l){return void 0===l&&(l="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(l),l}:e(jQuery)}(function(e){"use strict";e.fn.selectric||e.error("Selectric not initialized"),e.fn.selectricPlaceholder=function(t){return this.each(function(){var l=e(this),n=l.data("selectric"),r=e.extend({placeholderOnOpen:!0},t);n.elements.label.html(n.$element.attr("placeholder")),l.on("selectric-before-open",function(e,t,l){r.placeholderOnOpen&&l.elements.label.data("value",l.elements.label.html()).html(l.$element.attr("placeholder"))}),l.on("selectric-before-close",function(e,t,l){r.placeholderOnOpen&&l.elements.label.html(l.elements.label.data("value"))})})}});