Issue
My question is regarding a WordPress site. Using JavaScript or jQuery, on the entire front-end of the website, I would like to add the attribute accept="image/*"
to all of the <input type="file">
. Could someone please help me achieve this?
Solution
Quite trivial:
document.querySelectorAll("[type=file]")
.forEach(file => file.setAttribute("accept","image/*"))
You will still need to check the type of file on the server too
For example
Wordpress plugin development - File upload: How to allow specified file types?
Answered By - mplungjan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.