I need to add a stylesheet to my head, if a div class exists in my body.
i.e.
If this exists in my body:
<div class="myclass">...</div>
Add this to my head:
<link rel="stylesheet" href="/css/mystyle.css" type="text/css" media="screen" />
How do I do this with php?
check this url once click
<script type="text/javascript">
$(document).ready(function(){
if($("#myclass").size()>0){
if (document.createStyleSheet){
document.createStyleSheet('style.css');
}
else {
$("head").append($("<link rel='stylesheet' href='style.css' type='text/css' media='screen' />"));
}
}
});
</script>