2

I am using jquery bootpag to display pagination on a page

<div class="textgray showing"></div>

How should I tell jQuery to select this div? I tried the following without but neither of these attempts work

$(".textgray .showing").html("some text");

$(".textgray showing").html("some text");

P.S I am a beginner in frontend so bear with me

Denys Séguret
  • 355,860
  • 83
  • 755
  • 726
user2650277
  • 5,729
  • 16
  • 57
  • 120

2 Answers2

3

The space means the second part is inside the first one (it's called the descendant combinator). Remove it:

$(".textgray.showing").html("some text");
Denys Séguret
  • 355,860
  • 83
  • 755
  • 726
0

You don't need to put that extra space in between selector. space in selector looks for descendant elements:

$(".textgray.showing").html("some text");
Milind Anantwar
  • 79,642
  • 23
  • 92
  • 120