0

I know about those three type of selector in CSS: [att^=val] [att$=val] [att*=val] to select an element having an attribute value containing, ending or starting with a string. What I want to know is if there is a way to select an element having an attribute name containing a string ?

For example, to select all angulars attribute, I would write *[ng-*]{/*CSS rules*/}

EDIT: It seems that I didn't get understood... Let's say I have this HTML:

<a class="button" ng-click="doSmth()">execute</a>
<p class="button" data-ng-click="doSmth()">execute</p>

Now I want to select all elements having an attribute name AND NOT his value containing ng-click.

What I'm doing right now is

*[ng-click], *[data-ng-click]{
    cursor: pointer;
}

Is there a way of doing so without writing every single possibility. Maybe something like

*[*ng-click]{/*ALL elements having an attribute name starting with ANY string then ending with 'ng-click'*/
    cursor: pointer;
}

1 Answers1

1

Yes, you can use something like this.

HTML

<p name="para1">text</p>

CSS

[name=para1] { color: red; }
Andy Hoffman
  • 18,436
  • 4
  • 42
  • 61
  • 1
    I'm not sure you understood what I'm looking for, I've edited the question to be clearer, I'm not trying to select following the attribute value, but his own name – Bancarel Valentin May 11 '16 at 10:04