Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <div class="form-group pull-left">
  2. <input type="file" id="scriptFile" class="form-control input-sm inputfile">
  3. <label for="scriptFile"><div class="glyphicon glyphicon-open"></div><span> Choose a Script&hellip;</span></label>
  4. </div>
  5.  
  6. $("#scriptFile").change(function(event) {
  7. var file = event.target.files[0];
  8. // Just updates the "select a file" button to display the selected file's name.
  9. $("#scriptFile").next('label').find('span').html(" " + event.target.value.split( '\' ).pop());
  10. var reader = new FileReader();
  11. reader.onload = function(event) {
  12. editor.setValue(event.target.result);
  13. editor.clearSelection();
  14. };
  15. reader.readAsText(file);
  16. $('#scriptFile').addClass("selected"); //CSS purposes
  17. editor.focus();
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement