Currently, I am exploring the possibility of switching CSS styles using jQuery through a simple if
condition. Is there an easy method to switch styles based on IDs? In my case, I have two CSS blocks each with different IDs.
Here is an example:
<style id="styleA">
.myDiv {
display: none;
}
</style>
<style id="styleB">
.myDiv {
display: block;
}
</style>
<div class="myDiv">Lorem</div>
<script type="text/javascript">
$(document).ready(function()
{
var style = 4;
if (style < 5)
{
//apply css from styleA
}
else
{
//apply css from styleB
}
});
</script>