类不工作的jquery选择器选择器(bootpeg)

时间:2017-02-07 10:05:23

标签: jquery jquery-selectors

我正在使用jquery bootpag在页面上显示分页

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

我该如何告诉jQuery选择这个div?我试过以下但没有这些尝试都没有效果

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

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

P.S我是前端的初学者所以忍受我

2 个答案:

答案 0 :(得分:3)

空格意味着第二部分位于第一部分内(它被称为descendant combinator)。删除它:

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

答案 1 :(得分:0)

您无需在选择器之间添加额外空间。选择器中的空格查找后代元素:

$(".textgray.showing").html("some text");
相关问题