Created
February 25, 2016 13:57
-
-
Save JudeRosario/a812a504caa13a4876d8 to your computer and use it in GitHub Desktop.
Sorting JS
This file contains 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
add_action('wp_footer', 'custom_JS') ; | |
function custom_JS() { | |
echo <<<'JS' | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
$("select.app_select_workers").append($("select.app_select_workers option").remove().sort(function(a, b) { | |
var at = $(a).text(), bt = $(b).text(); | |
return (at > bt)?1:((at < bt)?-1:0); | |
})); | |
}) | |
</script> | |
JS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment