This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes onSelect attribute for html:select tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "onSelect attribute for html:select tag" Watch "onSelect attribute for html:select tag" New topic

onSelect attribute for html:select tag

M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
Hi all,

Whats the html:select equivalent of onselect attribute of select tag?
I went through all the attributes for html:select but there doesnt seem to be one for onselect functionality.

Sindhu Murthy<br />SCJP 1.4<br />SCBCD
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
onselect? I think you're looking for onclick
M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
What I am trying to achieve is everytime a user selects any of the options, I want to invoke a javascript, and depending on the value selected the javascript performs differently.
The problem with using onclick is that, it does not allow the user to select a particular value, instead when a user just clicks on the the drop down list the javascript gets called.
Ilja Smoli
Ranch Hand

Joined: Dec 02, 2001
Posts: 64
Im afraid onselect atrribute is only for textareas and text input types...
Look at html reference..

Btw you can use
[ December 21, 2004: Message edited by: Ilja Smoli ]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15379
onclick does not fire for tab events, you want to look at:


M Murthy
Ranch Hand

Joined: Nov 20, 2004
Posts: 33
calling a javascript in onchange in html:select works.
I agree. Here's the link:
subject: onSelect attribute for html:select tag