I am trying to add JavaScript code to show and hide some content with JQuery to my HTML page. When I add it in HTML code or in javaScript file with .js or in head or footer block the code is added and show in HTML code but it is not working. But when I add to test my same code in the console in the developer tool(Inspect) the code is working. I can't understand what is the issue. I am working on the page: https://radiusofficefurniture.ie/jemini-intro-1200-modular-straight-base-unit-maple-1200masama--1 The code is:
$(document).ready(function(){
var lenth_2 = $('.add_to_cart_custom .delivery--information').children().length;
if( lenth_2 > 1 ){
$('.add_to_cart_custom .delivery--information').hide();
$("p.delivery_custom").parent('.add_to_cart_custom .delivery--information').show();
$(".product_specs2 .item.attr_item_lead_time").hide();
}
});
And also when I add some other JS code to this page for other functionality the same issue occurs. And the issue only appears only on single products pages that have the same layout. For other pages, JS works when I add in Html.