JSFiddle - React, Tailwind, and code Playground

by nyothecat

HTML

<input type="text" id="gyuruszam" name="gyuruszam" />
<input type="file" id="photo1" name="photo1" />
<button>toto</button>

JavaScript

$(document).ready(function () {
    $('button').on("click", function () {
        var pic = document.getElementById("photo1").value;
        pic = pic.split('/').pop().split('\\').pop().replace(/[.][^.]+$/, "");
        var x = document.getElementById("gyuruszam");
        var gyuru = document.getElementById("gyuruszam").value;
        if (gyuru == null || gyuru == "" || gyuru == " ") {
            alert("Gyűrűszám nélkül nem lehet adatot lementeni!");
            x.focus();
            x.style.borderColor = "#C30";
            return false;
        } else if ((gyuru != pic) && (pic != null) && (pic != '')) {
            alert("A kép neve nem egyezik meg a gyűrűszámal!");
            return false;
        }
    });
});