I have a varable var file = "testfile.txt"; I am using the following script to find its extension and it works well:
var parts = file.split('.');
var flename = parts[0];
var ext = parts[1];
But if i have a filename with more than one dots, the logic sucks.. It will give txt for filename.txt, but not in the case of file.nam.e.txt or something else.
Anybody suggest me the simplest solution to do this using JavaScript and/or jQuery?