<div class="slider">content goes here</div>
<div id="slider-2" class="active inactive">also some content here</div>
<script type="text/javascript">
function checkEmpty( element ){
return !$.trim(element.html())
}
if (checkEmpty($('#slider'))) {
$("#slider-2").removeClass("inactive");
$("#slider-2").addClass("active");
} else {
$("#slider-2").removeClass("active");
$("#slider-2").addClass("inactive");
}
</script>
I have a requirement to display a div based on the content of another div. I believe using add and remove classes would be an effective solution.