{"id":16057382,"url":"https://github.com/aduth/jquery.optgrouper","last_synced_at":"2025-03-16T06:27:25.131Z","repository":{"id":6504754,"uuid":"7745318","full_name":"aduth/jquery.optgrouper","owner":"aduth","description":"Automatically group \u003coption\u003e's into \u003coptgroup\u003e's using a custom data-optgroup attribute","archived":false,"fork":false,"pushed_at":"2014-01-15T00:58:50.000Z","size":360,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T22:35:06.600Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://aduth.github.com/jquery.optgrouper/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aduth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-22T03:21:48.000Z","updated_at":"2014-01-15T00:58:51.000Z","dependencies_parsed_at":"2022-07-19T03:32:16.391Z","dependency_job_id":null,"html_url":"https://github.com/aduth/jquery.optgrouper","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fjquery.optgrouper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fjquery.optgrouper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fjquery.optgrouper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fjquery.optgrouper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aduth","download_url":"https://codeload.github.com/aduth/jquery.optgrouper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835951,"owners_count":20355611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T03:02:07.436Z","updated_at":"2025-03-16T06:27:25.101Z","avatar_url":"https://github.com/aduth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jQuery Optgrouper\n\nOptgrouper is a jQuery plugin which makes it easy to group related `\u003coption\u003e` elements into `\u003coptgroup\u003e` groupings using a custom `data-optgroup` attribute.\n\n[Demonstration](http://aduth.github.com/jquery.optgrouper/)\n\n## Usage\n\nAdd `data-optgroup` attribute to each `\u003coption\u003e` element.\n\n```html\n\u003cselect id=\"selAnimals\"\u003e\n    \u003coption data-optgroup=\"Mammals\"\u003eCheetah\u003c/option\u003e\n    \u003coption data-optgroup=\"Reptiles\"\u003eLizard\u003c/option\u003e\n    \u003coption data-optgroup=\"Reptiles\"\u003eSnake\u003c/option\u003e\n    \u003coption data-optgroup=\"Mammals\"\u003eElephant\u003c/option\u003e\n\u003c/select\u003e\n```\n\nInclude jquery.js and jquery.optgrouper.js, then call Optgrouper when page is ready.\n\n```html\n\u003cscript src=\"jquery.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"jquery.optgrouper.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n$(document).ready(function() {\n    $('#selAnimals').optgrouper();\n});\n\u003c/script\u003e\n```\n\n## Options\n\nThere are currently two options to control the behavior of Optgrouper.\n\n* `sortGroups` (Function) - Given an array of group names, return the same array in a custom sort order\n* `renderImmediately` (Boolean) - Control whether groups are rendered immediately upon plugin call (defaults to true)\n\n_Example_\n\n```javascript\n$('#selAnimals').optgrouper({\n    sortGroups: function(groups) {\n        return groups.sort();\n    },\n    renderImmediately: false\n}).data('plugin_optgrouper').renderGroups();\n\n```\n\n## License\n\nCopyright (c) 2014 Andrew Duthie\n\nReleased under the MIT License (see LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faduth%2Fjquery.optgrouper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faduth%2Fjquery.optgrouper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faduth%2Fjquery.optgrouper/lists"}