1

How can I select an css class in jquery (or javascript), if it looks like this:

.funkyradio input[type="checkbox"]:checked ~ label:before {}

So far I got this:

$('.funkyradio[type=checkbox]').click(function() {

But I do not know how to further approach.

John Does Legacy
  • 1,441
  • 6
  • 23
  • 33
  • 1
    class name is `funkyradio-success` or `funkyradio`? – Bhushan Kawadkar Apr 20 '16 at 13:27
  • 7
    You can't select the ::before specifically as it's not technically a DOM element. (see previous SO question: http://stackoverflow.com/questions/5041494/selecting-and-manipulating-css-pseudo-elements-such-as-before-and-after-usin) You can however select that actual element with `$('.funkyradio input[type="checkbox"]:checked ~ label').click();` – Frits Apr 20 '16 at 13:30
  • so no way to get ::before? – John Does Legacy Apr 20 '16 at 13:37
  • @JohnDoesLegacy have a look at [this](http://stackoverflow.com/a/21709814/4202224) answer – empiric Apr 20 '16 at 13:43

1 Answers1

1

Try this : Assuming funkyradio is the css class name. Put space between funkyradio and [type=checkbox] as checkbox is a child of funkyradio-success

$('.funkyradio [type=checkbox]').click(function() {
Bhushan Kawadkar
  • 28,279
  • 5
  • 35
  • 57