javascript - accessing to Jquery object values in a function -
i'm doing generic function validate form items. i'm calling way:
$('#name').validate(20, 'alfanum');
next, in function i'll stuff, when try access value of object, wont work:
function validate(size, type) { alert($(this).val()); // shouts error :( }
how can access object's value? thank in advance.
do need extend jquery's object use syntax? simpler pass object parameter
function validate(obj, size, type) { alert(obj.val()); // shouts error :( } validate(jquery('#name'), 20, 'alfanum');
Comments
Post a Comment