I'm working on a file that already has some code, and it uses php's ob_start() and ob_get_clean() functions around the jQuery being used. Is there a clear reason for why someone would do this?
ob_start();
?>
<script>
$(document).ready(function() {
$('div.scripture').on('click', function() {
$('div#schedule div.text').slideUp();
text = $(this).next('div.text');
if (text.is(":visible") == true) {
text.slideUp();
} else {
text.slideDown();
}
});
});
</script>
<?php
$additionalJS = (!empty($additionalJS)) ? $additionalJS : NULL;
$additionalJS .= ob_get_clean();