I have custom form for make perfect UX, have one field with button plus to add some details information, this field has validation (avoid the same value of the field) that i need to check DOM if is equal or not. Equality I need is the same DOM, not like code.
HTML:
<form id="form">
<select> ... </select><span class="btn"> + </span>
</form>
Javascript:
$("#form select").on('change', changeForm );
function changeForm() {
var check = $(this);
$("#form select").each(function(){ // In first index is exactly equal of variable check
if (check == $(this)) { ... } // false
if (check === $(this)) { ... } // false
if (check.isEqualNode($(this)) { ... } // Uncaught TypeError: undefined is not a function
if (check.isSameNode($(this)) { ... } // Uncaught TypeError: undefined is not a function
}
}
Has code to return true? Or my code doesn't is good way?