JSFiddle - React, Tailwind, and code Playground

by Yatin Luthra

HTML

<a class="ClassXYZ">File</a>
<input required type='File'>

JavaScript

$(':input[required]').each(function () {
       if ($(this).val() === '' && $(this).attr('type') == 'File') {
           alert($(this).prev("a").attr('class')); //here is my problem it returns undefined.
           }
        }
    )