'How to reference a webelement that has an attribute with no value?

Given an attribute that has this type of markup:

<label r4e-toggle="" class="sm ng-scope ng-isolate-scope r4e-toggle" 
       ng-attr-disabled="{{audit.profileOptedOut || undefined}}" 
       tooltip="Opted In" 
       ng-if="audit.source.listing.correctable &amp;&amp; audit.hasListingCorrecting">
    <input type="checkbox" ng-model="audit.optedOut" ng-true-value="false"
           ng-false-value="true" ng-click="location.optOutAudit($index, audit)" 
           ng-disabled="location.optOutDisabled" 
           class="ng-pristine ng-untouched ng-valid">
       <span class="slider"></span>
</label>

how do i reference it by the "r4e-toggle" that is blank?

As it appears in Google Dev tools: element markup in dev tools



Solution 1:[1]

Attributes are accessed the same way regardless if there is a value or not. Values can be provided to be more specific, but you just use square brackets for attribute selectors.

label[r4e-toggle]

https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gunderson