jQuery to check amount -


i'm trying write jquery event check if amount enter less or equal zero. if true clear entered amount.
after after event completion event running element setting default amount value zero. can please tell me how stop second event after completion of event.
i have tried using

event.stopimmediatepropagation(); event.preventdefault(); event.stoppropagation();  

but no success yet.

here code:

$(document).on('change', 'input[id^="amount_totalpaymentamout"]', function(event) {     var paymentamount = parsefloat($(this).val().replace(/,/g, ""));     if (paymentamount <= 0) {         $.sticky("total payment amounts entered should greater zero.", {             autoclose: 2000,             position: "top-right",             type: "st-error"         });         $(this).val('');         $(this).focus();         return false;     } }); 

try this:-

$(document).on("blur", "#yourid", function(e) {     var myval = $(this).val();     if(myval <= 0){         alert('amount less');         $(this).val('');         $(this).focus();         return false;     } }); 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -