JSFiddle - React, Tailwind, and code Playground

by Chris Rebert

HTML

<input id="q" type="text" value="foo.txt">

JavaScript

var input = document.getElementById('q');
input.type = 'file';
console.log("FILE: ", input.value);
input.type = 'text';
console.log("TEXT: ", input.value);