Skip to content

Instantly share code, notes, and snippets.

@miletskiy
Last active April 1, 2017 18:20
Show Gist options
  • Select an option

  • Save miletskiy/78a5d43ce4dcdb5990f391ed693208cc to your computer and use it in GitHub Desktop.

Select an option

Save miletskiy/78a5d43ce4dcdb5990f391ed693208cc to your computer and use it in GitHub Desktop.
for Alex
function (e) {
e.preventDefault();
$(e.currentTarget).parent().remove(); // delete from ul
return false;
}
// Corrected after review
$("document").ready(function() {
$("#fileUpload").on("change", function() {
//here add functions
var file = this.files[0];
var fileSize = file.size;
var getFullName = $('#fileUpload').val();
var splitName = getFullName.split("\\");
var fileName = splitName[2];
var addFileString = $('<li class="uploadParams">' + fileName + " " + fileSize + "bytes" +
// better to move into separate variable
'<a href="javascript:return:void(0);" class="glyphicon glyphicon-remove-circle pull-right removeFile btn" aria-hidden="true">xxx</a>' +
'</li>').appendTo('#fileList');
});
$('#fileList').on('click','a', function (e) {
console.log($(e.currentTarget));
e.preventDefault();
$(e.currentTarget).parent().remove();// delete from ul
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment