0

I'm trying to get only the div that have two classes and not just one.

The problem that in have tried it with jQuery that give me all divs that have one of the classes.

<div class='one'></div>
<div class='two'></div>
<div class='one two'>I just want to get this</div>
$('.one .two').html('ok');

this code return all three divs

Always Helping
  • 14,316
  • 4
  • 13
  • 29
tobili
  • 41
  • 4

1 Answers1

1

if you want to get just both classes you shouldn't add space between them in jquery selector

$('.one.two').html('ok');
Mo Shal
  • 1,587
  • 18
  • 25