jQuery - Setting .blur to a class
Question
I'm trying to set a blur on all 'number' classes (which happen to be tags).
My trial coding is;
$('.number').blur(function () {
if ($.isNumeric($(this).val) == false) alert('false ' + $(this).val);
else alert('true ' + $(this).val);
}) ;
It seems $(this) doesn't pick up the tag. Basically I want to be able to check whether the value is numeric of not.
Would be grateful any ideas/solutions to this problem.
Solution
val()
is a function and should be called with brackets.
OTHER TIPS
val
is a function.
$(this).val
should be
$(this).val()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow