mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 10:46:21 +00:00
12 lines
338 B
JavaScript
12 lines
338 B
JavaScript
|
$(document).on('turbolinks:load', function() {
|
||
|
$('input[type=file]').on('change', function(event) {
|
||
|
if (event.target.files.length == 0) return;
|
||
|
|
||
|
var input = $(event.target);
|
||
|
var preview = $(`#${input.data('preview')}`);
|
||
|
|
||
|
preview.attr('src',
|
||
|
window.URL.createObjectURL(event.target.files[0]));
|
||
|
});
|
||
|
});
|