Created
June 11, 2015 17:27
-
-
Save robspangler/f9cd0c6c3483f76ff20a to your computer and use it in GitHub Desktop.
Adds placeholder support for mobile devices using a single instance of jQuery Chosen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chosen_browser_is_supported = function() { | |
| if (window.navigator.appName === "Microsoft Internet Explorer") { | |
| return document.documentMode >= 8; | |
| } | |
| if (/iP(od|hone)/i.test(window.navigator.userAgent)) { | |
| return false; | |
| } | |
| if (/Android/i.test(window.navigator.userAgent)) { | |
| if (/Mobile/i.test(window.navigator.userAgent)) { | |
| return false; | |
| } | |
| } | |
| return true; | |
| }; | |
| if ( !chosen_browser_is_supported() ) { | |
| $('.chosen-select option:first').html($('.chosen-select').data('placeholder')); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment