Im working inside of opencart's framework. The base install has the exact same code but mine doesn't seem to be working. I'm not seeing any errors.
Im unsure how to make my selectors in jquery work. When the below code is ran it doesn't find the text in the span. Its returning an empty alert box. Am i doing something wrong or missing something?
alert($('#cart-total').text());
<button type="button"><span id="cart-total" ><?php echo $text_items; ?></span></button>
functions.min.js -> line 197
If youd like to see it in action: http://oc1.theaamgroup.com/ Press add to cart and watch.
UPDATE: I have added a new line to help with the debugging process. When you press on add to cart a alert box will pop up telling you waht the jquery selector found for #cart-total and then what it should have found.
Things I have tried:
Changing jquery versions
Moving the functions file to load before other files
(The selector works when its not inside the functions file for some reason.)
Same selectors at the top of the functions.min.js file
Same selectors at the bottom of the functions.min.js file
You can run the command in chrome console and it works fine.
Multiple css selectors.
UPDATE 2 At the end of functions.min.js line 498 i have added alert($('#cart-total').text()); to show that for whatever reason cart-total is returning nothing even when it starts (BY default if there are no products in your cart) 0 item(s) - $0.00