JSFiddle - React, Tailwind, and code Playground
HTML
<select name="top5" size="3" id="dropdown">
<option>Some Value</option>
</select>
<input type="text" id="num" value="2"/>
<input type="button" id="btn" value="Add"/>
<table id="tblspecializations">
<tr>
<td>Some Value</td>
<td>2</td>
<td>IGNORE ME</td>
</tr>
</table>
JavaScript
$(function(){
$("#btn").click(function(){
var table = $("#tblspecializations");
var firstTd = $("td:first", table);
var secondTd = firstTd.next();
if(firstTd.text() == $("#dropdown").val() && secondTd.text() == $("#num").val())
alert("Error: You're trying to add the same entry");
});
});