The detailed answer of the @NeedHate sentence. During the first check, you can save the “initial” value of the element in its data-... attribute, for example. So:
// по первому клику, например: // var vlll = $("#scanInput").val(); $("#scanInput").data('initial', $("#scanInput").val());
Then in subsequent comparisons:
// по другому событию, не первому: if( $("#scanInput").data('initial') == $("#scanInput").val()) { // равны } else { // не равны }
You can improve a lot: cache jQuery element; put everything in one handler then the first call from the subsequent ones will differ in the absence of a value in .data('initial') , or you can also set a second value to mark a non-first call: .data('notfirst', true) and check it .