Hello
After spending a considerable amount of time trying to figure this out, I seem to be stuck. I believe I am following the correct steps, but for some reason, it's not working. Any advice or suggestions would be greatly appreciated.
I am attempting to modify the display property from :none to :block in an external CSS stylesheet based on whether the value of a local storage key is null with the help of jQuery.
CSS
#cart-totals div.greysp1 {
display:none;
border-bottom: 1px solid #ccc;
padding: 3px 0;margin: 0 0 0 20px;
overflow: hidden;
text-align:left;
line-height:18px;
color:#888;
}
Javascript/jQuery
if(localStorage.getItem('userScribble') == null){
$("#cart-totals div.greysp1").css("display", "block");
console.log("null");
} else {
console.log("Not null")
}
HTML
<div id="cart-totals" >
<div class="cart-totals-content">
<div class="greysp1">
<div class="fL">Merchandise Subtotal:</div>
<div class="fR" id="MerchSubTotal"></div>
</div>
</div>
</div>
Any insights or recommendations?
I haven't come across any similar examples yet. If you have any, please share them with me.