最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

jQuery:nth-child前有无空格的区别分析_jquery

来源:动视网 责编:小采 时间:2020-11-27 20:59:51
文档

jQuery:nth-child前有无空格的区别分析_jquery

jQuery:nth-child前有无空格的区别分析_jquery:然后,我写了如下html: 11 12 13 21 22 23 31 32 33 预期效果是: 于是我写了如下jQ: $(.a:nth-child(2)).css(color,red); 运行发现结果竟然是: 我百思不得其解啊。最后发现把JQ改写为: $(.a :nth-child(2)).
推荐度:
导读jQuery:nth-child前有无空格的区别分析_jquery:然后,我写了如下html: 11 12 13 21 22 23 31 32 33 预期效果是: 于是我写了如下jQ: $(.a:nth-child(2)).css(color,red); 运行发现结果竟然是: 我百思不得其解啊。最后发现把JQ改写为: $(.a :nth-child(2)).


然后,我写了如下html:

















11 12 13
21 22 23
31 32 33

预期效果是:

于是我写了如下jQ:

$(".a:nth-child(2)").css("color","red");

运行发现结果竟然是:

我百思不得其解啊。最后发现把JQ改写为:

$(".a :nth-child(2)").css("color","red");

就行了。

注意:a后面有一个空格!!!

虽然问题解决了,但是不知道原因,求高手指点。。

if ($ != jQuery) { $ = jQuery.noConflict(); } var isLogined = false; var cb_blogId = 67455; var cb_entryId = 2102296; var cb_blogApp = "shengchanlix"; var cb_blogUserGuid = "4bedfe7d-722a-df11-ba8f-001cf0cd104b"; var cb_entryCreatedDate = '2011/7/10 15:13:00';

文档

jQuery:nth-child前有无空格的区别分析_jquery

jQuery:nth-child前有无空格的区别分析_jquery:然后,我写了如下html: 11 12 13 21 22 23 31 32 33 预期效果是: 于是我写了如下jQ: $(.a:nth-child(2)).css(color,red); 运行发现结果竟然是: 我百思不得其解啊。最后发现把JQ改写为: $(.a :nth-child(2)).
推荐度:
标签: 区别 空格 的区别
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top