In one of my divs, the CSS is set to have display: none
.cookie_policy
{
color: white;
text-align: justify;
width: 50%;
margin: 2% 25%;
line-height: 20px;
display: block;
font-family: Arial,Helvetica,sans-serif;
font-style: italic;
display:none;
}
<div class="cookie_policy">
content goes here
</div>
When the dropdown selection changes, I am attempting to display the div only if the dropdown value is 'GB'
$("#ddlCountry").change(function () {
if (this.value.indexOf('gb') != -1) {
//$('#cookie_policy').show();
$("#cookie_policy").css({ 'display': 'block' });
}
else {
$("#cookie_policy").css({ 'display': 'none' });
}
return false;
});
I'm having trouble figuring out where I went wrong in the code as the div is not displaying. I checked the CSS values using Firebug and noticed that the property still remains as none
. I tried using jQuery's show()
function but the div still isn't visible.
The version of jQuery I'm using is jquery-1.4.1.min.js
Please provide guidance on where I may be making an error