Hacker News new | past | comments | ask | show | jobs | submit login

[title^=“old”]

and

[title$=“old”]

Once you get used to using these, and their relatives, you find all kinds of uses for them, like applying styles only to telephone links:

  a[href^="tel:"]



You can do [data-foo*="banana"] and trigger it by changing the dataset to something that contains banana.

https://jsfiddle.net/gaby_de_wilde/s729uk61/


Definitely, also, they're called CSS selectors but I use them a lot in javascript for query selection too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: