Skip to content

Commit

Permalink
Updated package info for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniom committed Jul 7, 2016
1 parent ae59fc1 commit cdcf9cf
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
30 changes: 29 additions & 1 deletion dist/jquery.jquery-select-utils.js
Original file line number Diff line number Diff line change
@@ -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( $ ) {

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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($('<option>', {
value: (i + offset),
text: item
}));
});

return $(this);
}
};
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.jquery-select-utils.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-select-utils",
"version": "0.1.0",
"version": "0.2.0",
"description": "jQuery Select Utils",
"keywords": [
"jquery-plugin"
Expand Down

0 comments on commit cdcf9cf

Please sign in to comment.