user3058518
user3058518

Reputation: 35

jQuery/css not working with BigCommerce

So I've got this nice little div button navigation menu setup here FIDDLE and when I try to implement it on BigCommerce it doesn't work. I am running into a problem when I try to add a snippet "%%Panel.ProductDescription%%" into the text.

So this is the code that I amended with the snippet

$("#description").on("click", function() {
    $("#content").text( % % Panel.ProductDescription % % );
});

I've tried .text, I've tried using .html, I've tried making it a variable and calling it. I'm out of ideas. Anyone come across this before? Before adding the snippet the code works beautifully. After adding it the code stops working.

Upvotes: 0

Views: 1515

Answers (1)

developerscott
developerscott

Reputation: 923

The problem is that when you are trying to insert the text %%Panel.ProductDescription%% you are targeting a Bigcommerce template shortcode. Once the template is rendered that shortcode is no longer accessible by any means - including jQuery. When rendered that panel has the div id "ProductDescription". So your code should look more like this.

$("#description").on("click", function() {
    $("#content").text("#ProductDescription");
});

Note, however, that this div has other html in it. Either your jQuery should use .html instead of .text or you should think about targeting a div inside of the description panel.

.ProductDescriptionContainer is what actually holds the description content.

Upvotes: 3

Related Questions