The <optgroup> Tag Attributes Remover helps you remove attributes from <optgroup> elements in HTML. It keeps the <optgroup> tags and their nested <option> elements, while removing attributes such as label, disabled, class, and id.
<optgroup> Tag Attribute Remover
Paste HTML below to remove attributes from opening <optgroup> tags.
Step 1: Enter your HTML
Paste your HTML into the input box. You can enter a complete document or just the section containing a <select> element.
<select>
<optgroup label="Fruits" class="choices">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
</optgroup>
</select>
Step 2: Remove the attributes
Click the tool’s Remove <optgroup> attributes button. It finds each <optgroup> element and removes attributes attached directly to it. Attributes on the <select> and <option> elements are not removed.
Step 3: Copy the cleaned HTML
The result will look similar to this:
<select>
<optgroup>
<option value="apple">Apple</option>
<option value="orange">Orange</option>
</optgroup>
</select>
Copy the cleaned HTML and paste it into your code editor or website.
Helpful tips
Save a copy of your original HTML before using the tool. Removing the label attribute may make an option group harder to identify, and removing disabled can change whether its options are selectable. Review and test the output before using it on a live website.
Frequently Asked Questions
1. Which attributes are removed?
All attributes directly attached to <optgroup> elements, including label, disabled, class, id, and data-* attributes.
2. Are attributes on <option> elements affected?
No. The tool only removes attributes from <optgroup> elements. Nested <option> elements and their attributes are preserved.
3. Can I process multiple groups at once?
Yes. Paste HTML containing multiple <optgroup> elements, and the tool will remove attributes from each one.
4. Does the tool change the group’s options?
No. It preserves the nested options and their content. However, removing attributes such as label or disabled may affect how the select menu appears or behaves.