从另一个div中目标的锚标记中更改另一组div中存在的div的html

时间:2014-03-11 19:55:16

标签: javascript jquery

我正在尝试使用div函数更改div内的each的html,这个函数位于另一个div中的锚标记上。我的html格式是

<li class="Odd" style="width: 440px; height: 478px;">
    <div class="ProductImage QuickView" data-product="79" style="height: 460px; width: 280px;"> <a href="http://www.exmp.com/midnight-splendor/"><img src="http://cdn2.exmp.com/n-biq04i/bxoxsg/products/79/images/278/jpeg__18621.1394537835.280.460.jpg?c=1" alt="Midnight Splendor"></a>

        <div class="QuickViewBtn" style="background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(247, 247, 247)), to(rgb(220, 219, 219))); color: rgb(0, 0, 0); display: none; background-position: initial initial; background-repeat: initial initial;" data-product="79">Quick View</div>
    </div>
    <div class="ProductDetails" style="height: 0px;"> <a href="http://www.exmp.com/midnight-splendor/" class="pname"><strong>Midnight Splendor</strong></a>

        <div class="ProductPriceRating hdmenw" style="height: 15px;"> <span class="Rating Rating4"><img src="http://www.exmp.com/templates/__custom/images/IcoRating0.gif" alt="" style=""></span>

        </div>
        <div class="ProductActionAdd" style="display:;"> <a href="http://www.exmp.com/midnight-splendor/" class="hdmenw icon-Choose Options" title="Choose Options">&nbsp;</a>
 <em class="p-price"><strike class="RetailPriceValue">$40.00</strike> $20.00</em><em class="p-countdown"></em>

        </div>
    </div>
</li>

我的jquery函数是

$('.ProductImage a').each(function () {
    var link = $(this).attr('href');
    var $this = $(this);
    $.ajax({
        url: link,
        success: function (data) {
            var newImg = $(".d-date .Value div", data).html();
            if (newImg == null) {
                //Do Nothing
            } else {
                $this.parent(".ProductDetails").next('.p-countdown').html(newImg);
            }
        }
    });
});

正如您所看到的,我正在尝试将值放在.p-countdown内,但我希望在this下完成。正在返回该值我使用警报进行检查,但仍然无法正确定位.p-countdown

0 个答案:

没有答案