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

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

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