How can I change the css using jQuery such that it takes effect for future elements as well? I have an issue where I’m using $().show() to toggle the display on some elements, but then I append new elements with the same class, and they remain hidden.
<style type="text/css">
.visibleState { display: none; }
</style>
<script>
$('.visibleState').show();
$('#appendHere').html('<div id="second" class="visibleState">* Second is NOT? visible</div>');
</script>
This has probably been asked, but I can’t find it. I tried using live() in different ways, but that didn’t seem to work. What’s the right way to do this?
Example: http://jsfiddle.net/amorris/wykhv/
Look at this: