Search code examples
jqueryweebly

Adding custom jquery on a Weebly e-commerce product page


I am trying to style my Weebly e-commerce product pages by adding a few simple lines of jquery code.

So far, any place I try to add the code doesn't work. I've tried: 1. Adding the code directly to the page layout file in both the header, and right before the closing body tag 2. Adding the script as a "Custom HTML" drop in page object

Using method one, I can inspect the page, and I see that the code snippit I added is coming up on the page, but the script will not run. The script I am trying to add is the following:

<script type="text/javascript">
        $(document).ready(function() {
                $('#wsite-com-product-pricearea').clone().insertAfter("#insert-after-here");
            });
</script>

Does anyone have any experience adding jquery to weebly's e-commerce product pages? Any help would be appreciated. Alex


Solution

  • (function($) {
      $(function() {
        $('.wsite-product-description').prepend($('#wsite-com-product-short-description').html());
        var $btn = $('#wsite-com-product-buy');
        $('.wsite-product-description').first().append('<div id="something-cool"/>');
        $btn.appendTo('#something-cool').css('top', 0);
      });
    })(jQuery);