Programmatically remove specific class name from HTML element
.net, asp.net, c#
Solution
There is nothing built in to manage multiple values in the attribute.
You will have to parse the list, remove the class name and update the attribute.
Something like (untested):
var classes = myInput.Attributes["class"].Split(' ');
var updated = classes.Where(x => x != "classtoremove").ToArray();
myInput.Attributes["class"] = string.Join(" ", updated);
Problem
In C# ASP.NET I am adding a class to an `<input>` using: ``` myInput.Attributes.Add("class","myClass"); ``` At some point I would like to remove the added class (not all classes). Is there an equivalent along the lines of: ``` myInput.Attributes.Remove("class","myClass"); ``` `.Remove()` seems to only accept a key (no pair value). Thank you!