Is there a way to convert the file extension from .doc to .txt?
When I try alert(myvar), it shows an empty alert.
enter code here
<form>
<input type="file" id="f1">
<button onclick="myFunction(f1.value)">Try it</button>
</form>
<script>
function myFunction(a) {
var mystr = a;
var myarr = mystr.split(".doc");
var ex= ".txt";
var myvar = myarr + ex;
alert(myvar);
}
</script>