[英]Make text not go through element, when change value with javascript
I want to make a text preview, in multiple input file type.我想以多种输入文件类型进行文本预览。 I already make it but if the file is to much the text go through the element.
我已经做到了,但如果文件太多,则通过元素显示文本 go。 I try to wrap it but its not work.
我试着把它包起来,但它不起作用。 How I can make the text crop when the files is to much?
当文件太多时如何裁剪文本?
HTML HTML
<div class="form-group row">
<div class="col-sm-9 buat-input-div">
<label class="custom-file-label">Pilih File</label>
<input multiple type="file" class="form-control buat-input buat-input-file custom-file-input custom-file-input-multiple" name="filename" required>
</div>
</div>
Javascript Javascript
$(".custom-file-input-multiple").on("change", function() {
var files = $(".custom-file-input-multiple")[0].files;
var nama = '';
for (var i = 0; i < files.length; i++)
{
nama += ' ,'+files[i].name;
}
$(this).siblings(".custom-file-label").addClass("selected").html(nama);
});
Use bootstrap class overflow-hidden使用 bootstrap class 溢出隐藏
<div class="col-sm-9 buat-input-div overflow-hidden">File</label>
Demo: https://codepen.io/Hex0/pen/KKVLYpg演示: https://codepen.io/Hex0/pen/KKVLYpg
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.