Pass a reference to a dropdown menu

Please let me know how I can pass a reference to a dropdown menu as a parameter to a function in JavaScript.

If possible, please provide some sample code. Thanks!
dshrenikAsked:
Who is Participating?
 
Gurvinder Pal SinghConnect With a Mentor Commented:
<<I want to pass the whole dropdown menu as a parameter (not just its value).>>
<select onchange="myfunction(this)">
0
 
leakim971PluritechnicianCommented:
<select onchange="myfunction(this.value)">
0
 
dshrenikAuthor Commented:
I want to pass the whole dropdown menu as a parameter (not just its value).
0
 
jjperezaguinagaConnect With a Mentor Commented:
Greetings dshrenik,

Gurvinder372 is correct; "this" is the best way to send an object to a function. If you are familiar with jQuery, you can always call the form through an ID and query its elements: http://jsfiddle.net/YXagh/1/

Best regards,
-JJ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.