JQ 没有成功阻止冒泡事件

HTML:

 <div class="time-sort">

          <div class="border-time border-first active" onclick=""><span class="border-txt">相关度排序</span>

            <div class="bottom-btn"></div>

          </div>

          <div class="border-time" ><span class="border-txt">时间降序</span>

            <div class="bottom-btn"></div>

          </div>

          <div class="border-time border-time2"><span class="border-txt">时间升序</span>

            <div class="top2-btn"></div>

          </div>



JS:

$(document).ready(function (){  

//时间排序

$('.border-time').click(function(e){

event.stopPropagation();

$('.border-time').removeClass('active');

    $(e.target).addClass('active');

event.stopPropagation();

});


})


WongChouchan
浏览 1411回答 1
1回答

WongChouchan

已解决。将e.target改成this即可
打开App,查看更多内容
随时随地看视频慕课网APP