javascript - jQuery pre/append only within parent class name -
i have page lots of repeated items (a list of hotels)
i'm using optimizely , i'm trying move elements around in each hotel.
every time pre or append moves every element every hotel every element.
so i'm trying pre/append class name class name if it's in parent of class name.
the class name of each hotel .hotel:
$('.rating').prependto(function(){ $(this).parents('.hotel').prependto('.price-tag'); });
this isn't working, appreciated
i think want rating
prepended price-tag
element within current hotel
, in case
$('.rating').each(function () { $(this).closest('.hotel').find('.price-tag').prepend(this); });
Comments
Post a Comment