styling file upload

if(document.querySelector('input[type=file]')) { // query string exists // var button = document.querySelector('.gfield_description'); var input = document.querySelector('input[type=file]'); // Making input invisible, but leaving shown fo graceful degradation input.style.display = 'none'; button.style.display = 'initial'; button.addEventListener('click', function (e) { e.preventDefault(); input.click(); }); input.addEventListener('change', function () { button.innerText = this.value; }); } else { // no query string exists }
this selects athe output from the file selector and displays it on another div

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.