Questions tagged [optgroup]

The OPTGROUP element defines a group of choices within a SELECT menu.

The OPTGROUP element defines a group of choices within a SELECT menu. OPTGROUP must contain one or more OPTION elements to define the actual choice

Example:

<select>
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select> 

sources: http://htmlhelp.com/reference/html40/forms/optgroup.html, http://www.w3schools.com/tags/tag_optgroup.asp

259 questions
9
votes
2 answers

Adding optgroups to select using javascript dynamically

I have a dynamically populated (by ajax) select box with resulting options like that:
Adam
  • 1,470
  • 1
  • 17
  • 13
6
votes
1 answer

PHP: Dynamic Drop down with optgroup

I am developing a drop down menu that uses HTML optgroups for group names that employees are a part of. Here is the MySQL query and output: mysql> SELECT employees.emp_id,employees.empname,employees.grp_id,groups.groupname FROM employees left join…
drewrockshard
  • 2,043
  • 10
  • 35
  • 47
6
votes
1 answer

jQuery - Can not select first option on last optgroup

I have small problem. I need select option from B by value from selected
pida42
  • 63
  • 5
6
votes
1 answer

Rails - grouped_options_for_select

I am having some difficulty populating a select box in Rails with option groups using grouped_options_for_select. I currently have 3 instance variables that I would like to add to one entire grouped array for the grouped select box. For example, I…
Dodinas
  • 6,705
  • 22
  • 76
  • 108
6
votes
4 answers

Easy way to quick select a whole optgroup in select box

I have a select box in which i can select multiple options. In the select box are multiple optgroups. Is there an easy way to select a whole optgroup at once in javascript?
blub
  • 2,146
  • 4
  • 20
  • 19
6
votes
2 answers

Set a select by option value with optgroups

We do business in the US and Canada, so on a registration form I have a select that has optgroups to separate the US states from the Canadian provinces. I use the two character codes and store them in the database. When I want to edit the customer…
user1827294
6
votes
2 answers

jQuery to go to an optgroup label

I have a dropdown setup for searching. The idea is you click one option, Then the OPTGROUP appears. What I'd like to do is once the label is selected it jumps to that section of the OPTGROUP. I have written some jQuery so far. See this jsFiddle - So…
StuBlackett
  • 3,789
  • 15
  • 68
  • 113
5
votes
1 answer

How to include a "Please select..." (default/prompt) in a grouped dropdown list?

The code I am using for the dropdown list is this: <%= f.select :post_type_id, option_groups_from_collection_for_select(@categories, :post_types, :name, :id, :name) %> It neatly divides the options into optgroups. But how do I modify the code to…
Magne
  • 16,401
  • 10
  • 68
  • 88
5
votes
3 answers

Dynamic support in wicket

I'm looking to render a
LocustHorde
  • 6,361
  • 16
  • 65
  • 94
5
votes
1 answer

In Dropdown Laravel Blade show option in optgroup based upon a field in the table

I have a table which screenshot is attached below I want to show all the Account Type and but it should be shown in option group How can I achieve this???
Malik Awan
  • 115
  • 15
5
votes
3 answers

gives xhtml validation error

Error: End tag for 'optgroup' which is not finished. You have probably failed to include a required child element. Hence the parent element is "not finished", not complete. I want to achieve something like this in select…
user266307
  • 67
  • 1
  • 7
1
2
3
17 18