<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> <input class="price" type="text"> <p class="warning" style="display:none;">Неверное значение</p> <script> $('.price').on('keyup',function(){ if($(this).val()==0){ $('.warning').css("display","block"); }else{ $('.warning').css("display","none"); } }); </script>
UPD
Judging by the fact that the field is called price, I will assume that the letters there will be an error and it is better to write code like this
if($(this).val()>=1){ $('.warning').css("display","none"); }else{ $('.warning').css("display","block"); }
$(".price:text").val(function()...? Where did you see this? - Stepan Kasyanenko