why i can't use javascript function created inside jquery object and how to declare custom function