{"action":"created","issue":{"url":"https://api.github.com/repos/FezVrasta/dropdown.js/issues/14","labels_url":"https://api.github.com/repos/FezVrasta/dropdown.js/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/FezVrasta/dropdown.js/issues/14/comments","events_url":"https://api.github.com/repos/FezVrasta/dropdown.js/issues/14/events","html_url":"https://github.com/FezVrasta/dropdown.js/issues/14","id":71372701,"number":14,"title":"How to change which item is selected?","user":{"login":"Kirkman","id":761387,"avatar_url":"https://avatars.githubusercontent.com/u/761387?v=3","gravatar_id":"","url":"https://api.github.com/users/Kirkman","html_url":"https://github.com/Kirkman","followers_url":"https://api.github.com/users/Kirkman/followers","following_url":"https://api.github.com/users/Kirkman/following{/other_user}","gists_url":"https://api.github.com/users/Kirkman/gists{/gist_id}","starred_url":"https://api.github.com/users/Kirkman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kirkman/subscriptions","organizations_url":"https://api.github.com/users/Kirkman/orgs","repos_url":"https://api.github.com/users/Kirkman/repos","events_url":"https://api.github.com/users/Kirkman/events{/privacy}","received_events_url":"https://api.github.com/users/Kirkman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-04-27T19:04:19Z","updated_at":"2015-08-04T04:49:16Z","closed_at":null,"body":"I am using a dropdown together with a clickable map. If someone clicks an item in the map, I want to update the `<select>` list to show that item as being selected.\r\n\r\nDoing this doesn't seem to work:\r\n\r\n    $('#map-container .sample select').val(\"3\");\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FezVrasta/dropdown.js/issues/comments/127477662","html_url":"https://github.com/FezVrasta/dropdown.js/issues/14#issuecomment-127477662","issue_url":"https://api.github.com/repos/FezVrasta/dropdown.js/issues/14","id":127477662,"user":{"login":"nekkon","id":8094269,"avatar_url":"https://avatars.githubusercontent.com/u/8094269?v=3","gravatar_id":"","url":"https://api.github.com/users/nekkon","html_url":"https://github.com/nekkon","followers_url":"https://api.github.com/users/nekkon/followers","following_url":"https://api.github.com/users/nekkon/following{/other_user}","gists_url":"https://api.github.com/users/nekkon/gists{/gist_id}","starred_url":"https://api.github.com/users/nekkon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekkon/subscriptions","organizations_url":"https://api.github.com/users/nekkon/orgs","repos_url":"https://api.github.com/users/nekkon/repos","events_url":"https://api.github.com/users/nekkon/events{/privacy}","received_events_url":"https://api.github.com/users/nekkon/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T04:49:16Z","updated_at":"2015-08-04T04:49:16Z","body":"Had to fix it by myself, please support your plugin.. I'll be using it at my projects.\r\n\r\nFix:\r\n        $select.on(\"change\", function(e) {\r\n          var $this = $(e.target);\r\n          if (!$this.val().length) return;\r\n\r\n          if (!multi) {\r\n            var $selected;\r\n            if ($select.find(\":selected\").length) {\r\n              $selected = $select.find(\":selected\").last();\r\n            }\r\n            else {\r\n              $selected = $select.find(\"option, li\").first();\r\n              // $selected = $select.find(\"option\").first();\r\n            }\r\n            methods._select($dropdown, $selected);\r\n          } else {\r\n            methods._select($dropdown, $select.find(\":selected\"));\r\n          }\r\n        });\r\n\r\nAdd this on line 171"}}