JSFiddle - React, Tailwind, and code Playground
by Suryar Praveen
HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("button").click(function() {
var seen = {};
$('input[type=text]').each(function(i, item) {
var data = $(item).val();
if (seen.match(data)) {
$(this).remove();
} else {
alert(data);
}
})
});
</script>
</head>
<body>
<p>Name: <input type="text" name="user" id="user1"></p>
<p>Name2: <input type="text" name="user2" id="user2"></p>
<button>Set the value of the input field</button>
</body>
</html>