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?
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?
2
Answers
Quite trivial:
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?
Using jquery in wordpress
The following code uses
jquery
approach to solve your problem: