I have a very newbie, so I apologize if the answer to this is obvious.
I use jQuery to switch the contents of the elements depending on whether the element was clicked. I was able to successfully implement the switch function.
Now I need to load it with the first two elements set for show () and the rest for hide (). I gave a unique class name to these first two subjects. I know that I can just do $('div.activeitem').show()and then hide you, but I would prefer to set the condition.
I am a beginner in jQuery, so I don’t know how to target these elements or their classes in a conditional expression. I searched google but was unsuccessful. I want a condition that asks if the div "newsinfo" also has a class "jopen", then show (), else hide ().
Thank you for your help. I have attached my code to help you understand the context of my question:
<script type="text/javascript">
$(document).ready(function(){
$('div.newsinfo').hide();
$('h5.newstoggle').click(function() {
$(this).next('div').slideToggle(200);
return false;
});
});
</script>
source
share