Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | $(document).ready(function () { |
||
2 | |||
3 | // When an image is chosen, replace the "Choose a file" label |
||
4 | $('.custom-file-input').on('change',function () { |
||
5 | // Get the file name |
||
6 | let filePath = $(this).val(); |
||
7 | let fileName = filePath.replace(/^.*[\\\/]/, ''); |
||
8 | |||
9 | // Replace the "Choose a file" label |
||
10 | $('.selectedFile').html(fileName); |
||
11 | }) |
||
12 | |||
13 | // Delete an already uploaded image |
||
14 | $('.deleteImage').on('click',function () { |
||
15 | $(this).parent().parent().children('span').children("input[type='hidden']").val("true"); |
||
16 | $("img.uploadedImage").remove(); |
||
17 | }) |
||
18 | }); |
||
19 |