[jQuery] javascript in php loop, want to take if out of the php while statement?
Hi all,
I'm using cookies to hide some content on page load & at the moment
the jQuery code to do this inside a php loop, so the code below gets
executed up to 20 times.
any ideas on how i would include this only once to hide all content
supposed to be hidden?
...
while (!$display->EOF and $cnt < 20) {
other php code...
?>
<script type="text/javascript">
$(document).ready(function(){
if ($.cookieJar('CookieJar').get('<?php echo $box_id; ?>')) {
$("#<?php echo $box_id; ?>").hide();
}
});
</script>
<?php $display->MoveNext(); ?>