javascript change file extension code example
Example: 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('.');
var fName = leftRightStrings[0];
var fExtention = leftRightStrings[1];
var lengthFname = fName.length;
if(lengthFname > 15){
$(this).html(fName.substr(0,10) + "..." + fName.substr(-5) + "." +fExtention);
}
});
});
<script>