I wrote this small javascript function to run every 4 seconds or so. All it does is it clears messages (text) in a div, these messages only appear if a user clicks a button when they’re not supposed to. The function seems to be refreshing the whole page though, not just the div. What am I missing?
<script type="text/javascript">
function clearVoteMessages(){
var message = document.getElementById('votingNotifications').innerHTML = '';
}
</script>
Here’s the function, below is the div
<div id="voting_buttons">
<?php
echo CHtml::submitButton('Vote', array('submit' => array('Vote/CheckIfPollIsOpen')));
?>
<div id="votingNotifications">
<?php
if(isset($isPollOpen) && $isPollOpen == false)
{
$this->renderClip('cannotVoteYet');
}
if(isset($user) && $buttonClicked == true)
{
$this->renderClip('alreadyVoted');
}
?>
</div>
</div>