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

HTML

jdh
jdh
12,334 Points

Bootstrap Select Option Default Value

How can I set a default value on a bootstrap select option?

I want the option Total Points to be selected on default.

          <select ng-model='discussionsSelect' class='form-control'>
            <option value='total'>Total Points</option>
            <option value='created'>Created</option>
            <option value='read'>Read</option>
            <option value='replied'>Replied</option>
          </select>

Thanks!

1 Answer

James Alker
James Alker
8,554 Points

You could try using the 'selected' attribute to have Total Points selected on page load:

<option value='total' selected>Total Points</option>

Thanks.