Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drag_and_drop_file_validation() {
- ?>
- <script>
- jQuery(document).ready(function($) {
- $('button[type="submit"]', $('form.cart')).on("click", function(e) {
- var $file = $('input.wc-drag-n-drop-file');
- var $total_files = $('input[name^="' + $file.data('name') + '"]').length;
- $('.has-error-msg').remove();
- if ($total_files == 0) {
- $('.codedropz--results').after('<span class="has-error-msg">File upload is required.</span>');
- return false;
- }
- });
- });
- </script>
- <?php
- }
- add_action('wp_footer', 'drag_and_drop_file_validation');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement