Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jackie Jen
2,723 PointsHow can i set the default value of selection option in html
<select name="transporttype" id="transportmode" required="required" >
<option value="sea" >Sea</option>
<option value="air">Air</option>
<option value="land" >Land</option>
</select>
above code when i display it show that the default value is sea. How can i change the default to 'land' if i don't want to change the arrangement of above option?
I have add default="land" but couldn't take effect.
2 Answers
Andrew Dushane
9,264 PointsUse select="selected" on the default option.
<option value="land" selected="selected">Land</option>
Jackie Jen
2,723 Pointsthanks