HTML and CSS Reference
Hey, 80% of our customers
order ground beans. Can you
make it so the ground bean type
is already selected when the
user loads the page?
If you add an attribute called checked with a value of “checked”
into your radio input element, then that element will be
selected by default when the form is displayed by the browser.
Add the checked attribute to the “ground” radio <input>
element and give the page a test. Here's the solution.
Here's just the rele vant section
of the form in “for m.html”.
<form action="http://starbuzzcoffee.com/processorder.php" method="POST">
<p> Type: <br>
<input type="radio" name="beantype" value="whole"> Whole bean <br>
<input type="radio" name="beantype" value="ground" checked> Ground
And here's the new att ribute
that selec ts the “Grou nd”
radio but ton.