Javascript:
<script type="text/javascript">
function checkdata() {
$("#TextBoxesGroup :input").each(function () {
if (!$(this).val()) {
alert(this.val()+":Dis");
$("#addButton").attr("disabled", "disabled");
}
else {
alert(this.val() + ":Ena");
$("#addButton").removeAttr("disabled");
}
});
}
$(document).ready(function () {
$("#addButton").attr("disabled", "disabled");
$("#TextBoxesGroup :input").each(function () {
$(this).blur(function () {
checkdata();
});
});
});
</script>
Html
<div id='TextBoxesGroup'>
<div style="float: left; width: 625px;">
<div>
<input type="text" name="answer" class="ahsan" />
</div>
</div>
</div>
<div style="clear: both;">
</div>
<div>
<input type="button" value="Add New Row" class="qa-adbtn" id='addButton' />
</div>
Now the thing i want to do is that if user enter something in textbox(ahsan) .then add button enabled and if there is nothing in textbox onblur then add button automatically goes disabled