开发者

Jquery getting a child class of a selector retrieved using .prev

back = $("#contactus_"+id).prev();

I'm probably asking a simple question, but how do I get at .up_btn class from the id above?

no开发者_开发知识库rmally to target this class i would do $("#contactus_"+id+" .up_btn") however in this instance I can't place the class name in there like that since I want the previous sibling's child.

Thanks


If you mean .up_btn is found in that previous sibling,

$('#contactus_' + id).prev().find('.up_btn');

To use it with the back variable,

var back = $('#contactus_' + id).prev();
var btn = back.find('.up_btn');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜