Skip to content

Instantly share code, notes, and snippets.

@ourmaninamsterdam
Created April 8, 2015 12:35
Show Gist options
  • Save ourmaninamsterdam/e1acaa4ad3744d5f50d2 to your computer and use it in GitHub Desktop.
Save ourmaninamsterdam/e1acaa4ad3744d5f50d2 to your computer and use it in GitHub Desktop.
Set CSS attribute value
function setCSSAttributeSelectorValue(selector, value) {
return selector.slice(0, selector.lastIndexOf(']')) + '=' + value + ']';
}
@ourmaninamsterdam
Copy link
Author

setCSSAttributeSelectorValue('[data-something-something]','Dark Side')

// [data-something-something=Dark Side]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment