Clicking “Replace options” replaces them with a new set of options and then selects the “Green” one. Clicking the “Add option” button adds a new option to the end of the select and makes it the selected one. Get code examples like "how to add selected attribute to option using javascript" instantly right from your google search results with the Grepper Chrome Extension. Upload a File with Jersey using AJAX and HTML5 progress bar . The th:selected attribute is used to pre-select an option from a drop-down list in HTML documents. Note: The