Input FileUpload accept Property - Display the accepted content type of a <input type="file"> element: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input FileUpload

Description

Input FileUpload accept Property - Display the accepted content type of a <input type="file"> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Select a file to upload:
<input type="file" id="myFile" size="50">

<button onclick="myFunction()">Change accepted file types</button>

<p id="demo"></p>

<script>
function myFunction() {//ww  w  .j a v a 2 s .c o  m
    document.getElementById("myFile").accept = "audio/*,video/*";
    var v = document.getElementById("myFile").accept;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials