{"action":"created","issue":{"url":"https://api.github.com/repos/select2/select2/issues/3992","repository_url":"https://api.github.com/repos/select2/select2","labels_url":"https://api.github.com/repos/select2/select2/issues/3992/labels{/name}","comments_url":"https://api.github.com/repos/select2/select2/issues/3992/comments","events_url":"https://api.github.com/repos/select2/select2/issues/3992/events","html_url":"https://github.com/select2/select2/issues/3992","id":120470406,"number":3992,"title":"Uncaught TypeError: Cannot read property 'current' of null","user":{"login":"invot","id":2650927,"avatar_url":"https://avatars.githubusercontent.com/u/2650927?v=3","gravatar_id":"","url":"https://api.github.com/users/invot","html_url":"https://github.com/invot","followers_url":"https://api.github.com/users/invot/followers","following_url":"https://api.github.com/users/invot/following{/other_user}","gists_url":"https://api.github.com/users/invot/gists{/gist_id}","starred_url":"https://api.github.com/users/invot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/invot/subscriptions","organizations_url":"https://api.github.com/users/invot/orgs","repos_url":"https://api.github.com/users/invot/repos","events_url":"https://api.github.com/users/invot/events{/privacy}","received_events_url":"https://api.github.com/users/invot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-04T19:31:58Z","updated_at":"2016-04-21T08:57:14Z","closed_at":"2015-12-04T20:31:25Z","body":"        $('select.popLang').on('change', function(){\r\n            $('select.popLang').select2(\"destroy\");\r\n            var sel = $('select.popLang'),\r\n                iAr = [];\r\n            sel.children('option').attr('disabled',false);\r\n            if (sel.hasClass('noEng')) {\r\n                sel.find('option[value=\"39\"]').attr('disabled',true);\r\n            }\r\n            $.each(sel, function(){\r\n            var itm = $(this).find('option:selected').val();\r\n            iAr.push(itm);\r\n            });\r\n            $.each(iAr, function(key, val){\r\n                if (isNum(val)) {\r\n                    sel.find('option[value=\"'+val+'\"]').attr('disabled', true);\r\n                }    \r\n            });\r\n            $('select.popLang').select2();\r\n        });\r\n\r\nRunning this code the first time returns without error. However, after that it returns the error `Uncaught TypeError: Cannot read property 'current' of null` starting with `r.handle` in jQuery. Other than this error appearing, everything works. What could be the problem?"},"comment":{"url":"https://api.github.com/repos/select2/select2/issues/comments/212819735","html_url":"https://github.com/select2/select2/issues/3992#issuecomment-212819735","issue_url":"https://api.github.com/repos/select2/select2/issues/3992","id":212819735,"user":{"login":"ewsindia","id":7677713,"avatar_url":"https://avatars.githubusercontent.com/u/7677713?v=3","gravatar_id":"","url":"https://api.github.com/users/ewsindia","html_url":"https://github.com/ewsindia","followers_url":"https://api.github.com/users/ewsindia/followers","following_url":"https://api.github.com/users/ewsindia/following{/other_user}","gists_url":"https://api.github.com/users/ewsindia/gists{/gist_id}","starred_url":"https://api.github.com/users/ewsindia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewsindia/subscriptions","organizations_url":"https://api.github.com/users/ewsindia/orgs","repos_url":"https://api.github.com/users/ewsindia/repos","events_url":"https://api.github.com/users/ewsindia/events{/privacy}","received_events_url":"https://api.github.com/users/ewsindia/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T08:57:14Z","updated_at":"2016-04-21T08:57:14Z","body":"Facing same issue with select2\r\n $(\"select\").change(function () {\r\n        var dropdownidselctor = \"#\" + $(this).attr(\"id\");\r\n        console.info(dropdownidselctor + \" value = \" + $(dropdownidselctor).val());\r\n        if ($(dropdownidselctor + \" option:first\").val().length == 0 && $(this).val().length > 0) {\r\n            $(dropdownidselctor + \" option:first\").remove();\r\n            $(this).select2();\r\n        }\r\n    });\r\n\r\nbut if i run this on console  $(\"#someid\").select2(); then it doesn't return any error"}}