Created
August 20, 2015 04:40
-
-
Save beall49/135b2b79aa3da576ec43 to your computer and use it in GitHub Desktop.
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
| $('#btnSubmit').on('click', | |
| function(){ | |
| var finalWords = []; | |
| var txt = $("#txtInput").val().replace(/ /g,''); | |
| var words = txt.split(","); | |
| var newWords = words.sort(); | |
| for(x in newWords){ | |
| var str = newWords[x]; | |
| if (x>0){ | |
| str = " " + str | |
| } | |
| finalWords.push(str); | |
| } | |
| $("#txtInput").val(finalWords); | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment