how to trim the file name when length more than 10 in angular
<script src="js/jquery.js"></script>
<script>
$(document).ready(function(){
$('.uploadFilesItemHeader').find('#fileName').each(function() {
var fileNames = this.innerText;
var leftRightStrings = fileNames.split('.');
//file name
var fName = leftRightStrings[0];
//file extension
var fExtention = leftRightStrings[1];
var lengthFname = fName.length;
//if file name without extension contains more than 15 characters
if(lengthFname > 15){
$(this).html(fName.substr(0,10) + "..." + fName.substr(-5) + "." +fExtention);
}
});
});
<script>
Also in JavaScript:
- nuxtjs http multiple proxy
- conditional rendering alert if input fields are empty
- npm create react app
- javascript radian to degree
- npm google map api react
- navlink activestyle not working
- ajax syntax in javascript
- javascript use variable regex
- assign role on reaction by id discord.js
- transpose of the matrix in javascript
- dropdown option selection change event in jquery
- react native text input next field hooks focus
- react native vs flutter
- how to convert jsonobject to json string in java
- javascript keydown
- rounding up a number so that it is divisible by 5 javascript
- how to print NODE_PATH
- angular stable version
- get page link angular
- js math random
- displaying the date react
- how do i backspace from javascript calculator
- jquery add element to array
- javascript get 24 hour time