I'm fairly new to javascript and I'm wondering how I could get this piece of code (part of a bigger whole) to do what I want. I'd like to add HTML to the prhases 'articles in shopping cart' and 'article in shopping cart'. Is this possible? Many thanks.
I don't mean styling (bold or italic), this is what i'd want it to return:
return quantity + (quantity == 1 ? '
article in shopping cart <span class="simpleCart_quantity"></span>-
<span class="simpleCart_total"></span>
<a href="shoppingcart.html">Show</a>' :
' articles in shopping cart
<span class="simpleCart_quantity"></span>-
<span class="simpleCart_total"></span>
<a href="shoppingcart.html">Show</a>');
I know this is not possible, how is it possible?
quantity: function () {
var quantity = 0;
simpleCart.each(function (item) {
quantity += item.quantity();
});
if (quantity == 0) {
return 'Your shopping cart is empty';
} else {
return quantity + (quantity == 1 ? ' article in shopping cart' : ' articles in shopping cart');
}
},