Reputation: 913
I have called a JQuery function in onblur event and in that function I used focus()
.
But, the JQuery focus()
is not working.
<input type="text" name="stdmeas['XXL']" id="XXL_qty" value="<?php echo $XXL;?>" size="5" onblur="return fnqtyCount();" />
function fnqtyCount() {
if(!$.isNumeric( XXL_qty )) {
$("#err_msg").text("Please enter the numeric values only.");
$("#XXL_qty").val('');
$("#XXL_qty").focus();
return false;
}
}
Upvotes: 0
Views: 231
Reputation: 3661
function fnqtyCount() {
var text = $("#XXL_qty").val();
if (!$.isNumeric(text)) {
$("#err_msg").text("Please enter the numeric values only.");
$("#XXL_qty").val('');
$("#XXL_qty").focus();
return false;
}
}
Upvotes: 1
Reputation: 1937
as per my understanding , the code should be as follows
function fnqtyCount() {
if(!$.isNumeric( $("#XXL_qty").val() )) {
$("#err_msg").text("Please enter the numeric values only.");
$("#XXL_qty").val('');
$("#XXL_qty").focus();
return false;
}
}
Upvotes: 3