• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i get the value of a select from a drop down without a form into javascript?

 
John Robert
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello ranchers,

I have a jsp which has a drop down and a link. On clicking the link a javascript is called, something like the code below..

I know this page has no practical use.I understand i can put all this on a form and then retrive the value of the select in the javascript function. All I am trying to understand is, inorder to get the value of an element in javascript function, is it required that it be put on a form? I am just curious..

Any response would be appreciated.
[ October 17, 2008: Message edited by: John Robert ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it required that it be put on a form?
No. Give the element an id value and use it to reference the element.
[ October 17, 2008: Message edited by: Bear Bibeault ]
 
John Robert
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow that was really quick, thanks Bear..
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell me that is not your actual code...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic