Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: avoid compressing imagepicker react native 
Javascript :: dropzone react npm 
Javascript :: javascript delete dict value 
Javascript :: how to check if a user sent a message in discord js 
Javascript :: repeat call n times in js 
Javascript :: javascript delete object from array 
Javascript :: .includes javascript 
Javascript :: play audio file in phaser 
Javascript :: instagram unfollow console code 
Javascript :: regex 1-31 days 
Javascript :: inject html via template tags js 
Javascript :: searchbar to bottom table datatable 
Javascript :: merge two binary trees 
Javascript :: javascript typeof array 
Javascript :: defaultdeep lodash 
Javascript :: map array with only lenghth given 
Javascript :: kendo js add one day to a date 
Javascript :: es6 get first and last element of array 
Javascript :: agrgar atributo con id jquey 
Javascript :: deploy react to azure : web.config 
Javascript :: how to add row in angular dynamically 
Javascript :: get selected option from select javascript 
Javascript :: Using the Sanity client without specifying an API version is deprecated 
Javascript :: what is useref in react 
Javascript :: timer in angular 8 
Javascript :: Reactjs exemple class component 
Javascript :: onclick timer javascript 
Javascript :: leaflet js mobile popup not opening 
Javascript :: appregistry react native 
Javascript :: import bootstrap 4 in react 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =