使用jquery在另一个元素的同级中查找元素

使用jquery在另一个元素的同级中查找元素,jquery,Jquery,使用.find()而不是.next()作为。currTime是的子元素,而不是下一个同级元素。进度显示: <div class="container"> <input type="button" value="play" class="btnplay"></input> <audio class="song"> <source src="<%# Eval("f_audio") %>" />

使用
.find()
而不是
.next()
作为
。currTime
的子元素,而不是下一个同级元素。进度显示

<div class="container">
    <input type="button" value="play" class="btnplay"></input>
    <audio class="song">
        <source src="<%# Eval("f_audio") %>" />
    </audio>
    <div class="progress-show">
        <span class=".currTime">dsgbadgnsetb</span>
        <input class="progress-slider mdl-slider mdl-js-slider" type="range" min="0" max="100" value="0" tabindex="0">
        <span class=".totalTime">sfhsg s</span>
        <input class="volume-slider mdl-slider mdl-js-slider" type="range" min="0" max="100" value="50" tabindex="0">
    </div>
</div>

更改HTML并将CSS类重命名为
currTime
而不是
.currTime
,否则需要将
作为元字符转义

HTML更改

$('.btnplay').click(function () {
    $(this).siblings('.progress-show').find('.currTime').text('111111');
});

使用现有HTML,使用
\\
转义元字符

$('.btnplay').click(function () {
    $(this).siblings('.progress-show').children('.currTime').text('111111');
});

.next()
将获取您的

我使用了一个转发器,因此有许多div具有相同的类,因此我无法轻松使用$('.currTime'),我需要在此上下文中找到它。您的
字段不关闭是否正常?谢谢,我犯了一个愚蠢的错误,使用了.currTime作为类名:D
$('.btnplay').click(function () {
    $(this).siblings('.progress-show').children('.currTime').text('111111');
});
$('.btnplay').click(function () {
    $(this).siblings('.progress-show').children('.\\.currTime').text('111111');
});
jQuery(".btnplay").click(function() {
    jQuery(this).siblings(".progress-show").find(".currTime").text("Some Text");
});