Javascript examples for DOM HTML Element:OptionGroup
optgroup - Return the label/description of an option-group:
<!DOCTYPE html> <html> <body> <select size="6"> <option value="B">B</option> <option value="M">M</option> <optgroup id="myOptgroup" label="Swedish Cars"> <option value="css">CSS</option> <option value="html">HTML</option> <option value="sql">SQL</option> </optgroup> </select>/* ww w.ja v a 2 s. c om*/ <button onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("myOptgroup").label = "selection"; } </script> </body> </html>