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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -