aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Can i get the value of a select from a drop down without a form into javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Can i get the value of a select from a drop down without a form into javascript?" Watch "Can i get the value of a select from a drop down without a form into javascript?" New topic
Author

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

John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39
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

Joined: Jan 10, 2002
Posts: 60985
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39
wow that was really quick, thanks Bear..
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Please tell me that is not your actual code...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can i get the value of a select from a drop down without a form into javascript?