To determine if an element has been selected, I rely on checking for the presence of an additional CSS class called "selected" that is added to the element
The structure of my element is as follows:
<div class="b-wide-option" data-bind="css: { selected: IsSelected }, click: Select, attr: { id: Id }, event: { mouseover: OnMouseOver, mouseout: OnMouseOut, touchstart: OnTouchClick }" id="2">
After selecting it, the element appears like this:
<div class="b-wide-option selected" data-bind="css: { selected: IsSelected }, click: Select, attr: { id: Id }, event: { mouseover: OnMouseOver, mouseout: OnMouseOut, touchstart: OnTouchClick }" id="2">
I need to verify whether the CSS class "selected" has been successfully added. To do so, I have implemented the following code snippet:
string classes = element.GetAttribute("class");
However, I observed that this code only retrieves the first class "b-wide-option", failing to capture the important second class that I am interested in.