From cdcf9cf565abbde25e621f818fcc79ce48484076 Mon Sep 17 00:00:00 2001 From: Antonis Balasas Date: Thu, 7 Jul 2016 21:04:19 +0300 Subject: [PATCH] Updated package info for new version --- README.md | 5 +++++ bower.json | 2 +- dist/jquery.jquery-select-utils.js | 30 +++++++++++++++++++++++++- dist/jquery.jquery-select-utils.min.js | 4 ++-- package.json | 2 +- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 33dafd7..f171851 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ A collection of methods to handle HTML's SELECT elements. [![Build Status](https://travis-ci.org/antoniom/jquery-select-utils.svg?branch=master)](https://travis-ci.org/antoniom/jquery-select-utils) +## Installation +``` +bower install jquery-select-utils +``` + ## Getting Started Download the [production version][min] or the [development version][max]. diff --git a/bower.json b/bower.json index 1329389..92df81a 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name":"jquery-select-utils", "description": "A collection of methods to handle HTML's SELECT elements.", - "version":"0.1.0", + "version":"0.2.0", "keywords": [ "select", "dropdown", diff --git a/dist/jquery.jquery-select-utils.js b/dist/jquery.jquery-select-utils.js index e079db9..2102b3e 100644 --- a/dist/jquery.jquery-select-utils.js +++ b/dist/jquery.jquery-select-utils.js @@ -1,4 +1,4 @@ -/*! jquery-select-utils - v0.1.0 - 2016-07-05 +/*! jquery-select-utils - v0.2.0 - 2016-07-07 * Copyright (c) 2016 Antonis Balasas; Licensed MIT */ (function( $ ) { @@ -28,6 +28,16 @@ return prompt; }; + var getOffsetArgument = function(offset) { + if ($.type(offset) === 'number') { + offset = offset; + } else { + offset = 0; + } + + return offset; + }; + var methods = { setEmpty: function(defaultTxt) { $(this).find('option').remove().end(); @@ -56,6 +66,24 @@ })); }); + return $(this); + }, + populateFromArray: function(items, prompt, offset) { + + var list = $(this); + prompt = getPromptArgument(prompt); + + $(this).selectUtils('setEmpty', prompt); + + offset = getOffsetArgument(offset); + + $.each(items, function (i, item) { + list.append($('