JS appendTo元素

时间:2018-04-30 13:18:45

标签: javascript jquery

嗨,请有人帮帮我吗?我有一个问题就是找到一个propper Jquery来将一个元素添加到他的兄弟中。

enter image description here

但是在输入之后:

$(document).ready(function(){
    var place = '.portfolio_item_hover .item_info span.price';
$('.quant a.button').prependTo(place);

});

enter image description here

请允许任何人帮我处理我必须输入的代码。

                                                                                             带口袋的连帽衫                          45.00€ 35.00€                                                                Pridaťdokošíka         

2 个答案:

答案 0 :(得分:0)

试试这个:



$(document).ready(function(){
  var $place = $('.portfolio_item_hover .item_info span.price');
  var $elementToPrepend = $('.quant a.button');
  
  $elementToPrepend.prependTo($place);
});




答案 1 :(得分:0)

<div class="quant col-md-4 col-sm-6 hoodies-clothing " style="position: absolute; left: 0px; top: 0px;">
            <a id="64" class="portfolio_item wow fadeInUp" href="http://piso.seduco.sk/produkt/hoodie-with-pocket/" title="Hoodie with Pocket" style="visibility: visible; animation-name: fadeInUp;">
                <img src="./piso.seduco.sk_files/hoodie-with-pocket-2.jpg" alt="image" class="img-responsive"> 
                <div class="portfolio_item_hover">
                    <div class="item_info">
                        <span>Hoodie with Pocket</span>
                        <span class="price"><del><span class="woocommerce-Price-amount amount">45.00<span class="woocommerce-Price-currencySymbol">€</span></span></del> <ins><span class="woocommerce-Price-amount amount">35.00<span class="woocommerce-Price-currencySymbol">€</span></span></ins></span> 
                    </div>
                </div>
            </a>
            <a href="http://piso.seduco.sk/?add-to-cart=64" data-quantity="1" class="button product_type_simple add_to_cart_button ajax_add_to_cart" data-product_id="64" data-product_sku="woo-hoodie-with-pocket" aria-label="Add “Hoodie with Pocket” to your cart" rel="nofollow">Pridať do košíka</a>
        </div>