How do I pass the id of my widget to javascript in the form function?

How do I pass the id of my widget to javascript in the form function?