my dog learned polymorphism*
The moose likes Servlets and the fly likes I would like it to autoselect the first item in the combo box rather than having to click on the arr Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "I would like it to autoselect the first item in the combo box rather than having to click on the arr" Watch "I would like it to autoselect the first item in the combo box rather than having to click on the arr" New topic
Author

I would like it to autoselect the first item in the combo box rather than having to click on the arr

Anitha Kuchana
Greenhorn

Joined: Dec 22, 2011
Posts: 21
i have a one drop down box . and i have a one text box in that text box i entered date and i wriitten a on focus event for that text for that i written a java script method in that i checked given date is greater than the current date at that time the combo box value as 00:00 default value .what can i do .I would like it to autos elect the first item in the combo box rather than having to click on the arrow .what code wriiten in javascript.please any one help me.
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 459
    
    1
Refer this link.


Vinod Tiwari | Twitter
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

You don't need any JavaScript. Simply put the selected attribute on the option element you want to be initially selected.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I would like it to autoselect the first item in the combo box rather than having to click on the arr
 
Similar Threads
dynamically adding component to JPanel
TableCellEditor ComboBox in JTable
Another JTable Cell Editor / Renderer question.
JPopupmenu not working w/ JComboBox metal L&F
Update more than one rows through one Submit/Update Button