{"action":"opened","issue":{"url":"https://api.github.com/repos/kartik-v/yii2-widget-select2/issues/144","repository_url":"https://api.github.com/repos/kartik-v/yii2-widget-select2","labels_url":"https://api.github.com/repos/kartik-v/yii2-widget-select2/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/kartik-v/yii2-widget-select2/issues/144/comments","events_url":"https://api.github.com/repos/kartik-v/yii2-widget-select2/issues/144/events","html_url":"https://github.com/kartik-v/yii2-widget-select2/issues/144","id":149417068,"number":144,"title":"How to Add Jquery for Option Group?","user":{"login":"InsaneSkull","id":14233668,"avatar_url":"https://avatars.githubusercontent.com/u/14233668?v=3","gravatar_id":"","url":"https://api.github.com/users/InsaneSkull","html_url":"https://github.com/InsaneSkull","followers_url":"https://api.github.com/users/InsaneSkull/followers","following_url":"https://api.github.com/users/InsaneSkull/following{/other_user}","gists_url":"https://api.github.com/users/InsaneSkull/gists{/gist_id}","starred_url":"https://api.github.com/users/InsaneSkull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InsaneSkull/subscriptions","organizations_url":"https://api.github.com/users/InsaneSkull/orgs","repos_url":"https://api.github.com/users/InsaneSkull/repos","events_url":"https://api.github.com/users/InsaneSkull/events{/privacy}","received_events_url":"https://api.github.com/users/InsaneSkull/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-19T10:30:09Z","updated_at":"2016-04-19T10:30:09Z","closed_at":null,"body":"I want to allow only one selection per option group. how to do it?\r\n\r\nHow to convert below script to work on  select2?\r\n\r\n    $('select optgroup option').click(function () {\r\n      var len = $(this).parent().find(':selected').length\r\n       if (len > 1) {\r\n            $(this).prop('selected', false);\r\n       }\r\n    });"}}