I'm trying to build a JQuery selector that finds a single element with a [data-label] attribute that has any value other than blank. An example of what I've got at the moment is:
$(formSelector).find("[data-label*='-']")
Which gets me:
<fieldset data-label="vehicle-enquiry"></fieldset>
AND
<span class="btn--icon btn__icon__pos-- dws-icon- " data-label="">Submit enquiry</span>
Which is almost exactly what I want, in that data-labels should have a '-' in their value, but I'm concerned it's not robust enough - the moment someone adds a label without a '-' it'll break.
It has to be very generic to work across multiple forms with different data-labels. It seems I can do any other kind of attribute selection in an obvious way, but not this.