What wrong with this validation:
Jquery:
$(document).ready(function(){
$("#addcmd").attr("disabled","disabled");
$("#cmdstxt").keypress( function(event){
var txt=$("#cmdstxt");
if( txt.val().length > 8 ){
$("#addcmd").attr("disabled",false);
}
else{
$("#addcmd").attr("disabled","disabled");
}
}); });
Html code:
<textarea class="element" name="about" id="cmdstxt"></textarea>
<input type="button" id="addcmd" value="Add comment" />
Here my problem is the button enable only after 10 char disabled only when 7 char in text box how can I overcome this issue?
Live Demo
You have wrong spelling of length in condition for enabling button.