jQuery siblings的使用

$('.usebtn-victory').each(function(){
        $(this).click(function(){
            if($(this).text()=='选择'){
                $(this).text('已选择');
                $(this).parents('.mui-table-view-cell').siblings().find('.usebtn-victory').text('选择');
            }else{
                $(this).text('选择');
            }
                
        });
});
         <li class="mui-table-view-cell">
                    <div id="container1" class="coupon-container coupon-item orange">
                        <!-- <a href="coupon_show.html" class="coupon-item orange "> -->
                            <div class="coupon-dots">
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                            </div>
                            <div class="coupon-left">
                                <div class="title">
                                    <span class="subtitle">¥</span>
                                    10

                                </div>
                                <div class="subtitle">无金额门槛
                    </div>
                            </div>
                            <div class="coupon-right">
                                <div class="title">满50减10
                                </div>
                                <div class="subtitle">消费任意金额立减10
                            </div>
                                <div class="subtitle light"></div>
                                <div class="usetime">
                                    <div class="text">有效期至 2018.10.16
                            </div>
                                    <div class="usebtn">选择
                            </div>
                                </div>
                            </div>
                        <!-- </a> -->
                    </div>
                </li>
                <li class="mui-table-view-cell">
                    <div id="container2" class="coupon-container coupon-item orange">
                        <!-- <a href="#" class="coupon-item orange "> -->
                            <div class="coupon-dots">
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                                <i></i>
                            </div>
                            <div class="coupon-left">
                                <div class="title">
                                    <span class="subtitle">¥</span>
                                    10

                                </div>
                                <div class="subtitle">无金额门槛
                                            </div>
                            </div>
                            <div class="coupon-right">
                                <div class="title">满50减10
                                            </div>
                                <div class="subtitle">消费任意金额立减10
                                            </div>
                                <div class="subtitle light"></div>
                                <div class="usetime">
                                    <div class="text">有效期至 2018.10.16
                                                </div>
                                    <div class="usebtn">选择
                                         </div>
                                </div>
                            </div>
                        <!-- </a> -->
                    </div>
                </li>

 

No comments, so go and ...add one

Speak Your Mind

Your email address will not be published. Required fiels are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>