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
  • 372,613
  • 87
  • 782
  • 758
user2650277
  • 6,289
  • 17
  • 63
  • 132

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
  • 372,613
  • 87
  • 782
  • 758
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
  • 81,290
  • 25
  • 94
  • 125