{"action":"created","issue":{"url":"https://api.github.com/repos/select2/select2/issues/1740","labels_url":"https://api.github.com/repos/select2/select2/issues/1740/labels{/name}","comments_url":"https://api.github.com/repos/select2/select2/issues/1740/comments","events_url":"https://api.github.com/repos/select2/select2/issues/1740/events","html_url":"https://github.com/select2/select2/issues/1740","id":19851348,"number":1740,"title":"Able to set the list to a disabled value but not then read its value back","user":{"login":"aquavark","id":5259299,"avatar_url":"https://avatars.githubusercontent.com/u/5259299?v=3","gravatar_id":"","url":"https://api.github.com/users/aquavark","html_url":"https://github.com/aquavark","followers_url":"https://api.github.com/users/aquavark/followers","following_url":"https://api.github.com/users/aquavark/following{/other_user}","gists_url":"https://api.github.com/users/aquavark/gists{/gist_id}","starred_url":"https://api.github.com/users/aquavark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aquavark/subscriptions","organizations_url":"https://api.github.com/users/aquavark/orgs","repos_url":"https://api.github.com/users/aquavark/repos","events_url":"https://api.github.com/users/aquavark/events{/privacy}","received_events_url":"https://api.github.com/users/aquavark/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-09-21T04:18:14Z","updated_at":"2015-05-16T20:37:03Z","closed_at":"2015-05-16T20:37:03Z","body":"In a select, values can be set to disabled, and will display in the list but with a grey background and cannot be user selected (as expected).\r\n\r\nHowever, calling $(\"#list\").select2(\"val\",value) will set this item to be the visible one on the list.\r\n\r\nWhen you then attempt to get the value back (using $('#list').val()) you get \"null\" returned, and not the value that is being displayed on the select2.\r\n\r\nThis has shown up as I am actually after a method to be able to set disabled items as the selected one programmatically, but not to let the user actually choose them (so they have to be in the list to do this, but set to disabled from the user perspective). In this use case I am limiting background colours for user selected, but selecting from another list can choose background colours that are not available to the user."},"comment":{"url":"https://api.github.com/repos/select2/select2/issues/comments/102686281","html_url":"https://github.com/select2/select2/issues/1740#issuecomment-102686281","issue_url":"https://api.github.com/repos/select2/select2/issues/1740","id":102686281,"user":{"login":"kevin-brown","id":1991850,"avatar_url":"https://avatars.githubusercontent.com/u/1991850?v=3","gravatar_id":"","url":"https://api.github.com/users/kevin-brown","html_url":"https://github.com/kevin-brown","followers_url":"https://api.github.com/users/kevin-brown/followers","following_url":"https://api.github.com/users/kevin-brown/following{/other_user}","gists_url":"https://api.github.com/users/kevin-brown/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin-brown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin-brown/subscriptions","organizations_url":"https://api.github.com/users/kevin-brown/orgs","repos_url":"https://api.github.com/users/kevin-brown/repos","events_url":"https://api.github.com/users/kevin-brown/events{/privacy}","received_events_url":"https://api.github.com/users/kevin-brown/received_events","type":"User","site_admin":false},"created_at":"2015-05-16T20:37:03Z","updated_at":"2015-05-16T20:37:03Z","body":"This should be fixed in 4.0, `.select2(\"val\")` is mapped to `.val()` so things behave in similar ways to a regular `<select>`.\r\n\r\nIf it is not fixed, please add a :+1: to the ticket to bring it to our attention. Please also include an example that we can test to verify that it is not actually working."}}