I have this working code but why the checkbox is not affecting it?.
$("#btn").click(function() {
if ($("#txt2").val() == 2) {
alert("Hello");
$("#txt").removeClass('validation');
$("#chk").removeClass('validation');
} else {
$("#txt").addClass('validation');
$("#chk").addClass('validation');
}
});
.validation {
border: 1px solid #ff0000;
background-color: #ffeeee;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<tr>
<td>
<input type="checkbox" id="chk">
<input type="text" id="txt">
</td>
</tr>
<input type="text" id="txt2">
<input type="button" id="btn" value="Click">
Anyone know about this issue or problem?.