I am trying to change the body background-color to a random color on a button click.
<script>
$( document ).ready(function() {
$('.SpecButton').click(function() {
$('body').css('background-color',"<?php
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
$color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
echo $color;
?>");
});
});
</script>
The problem is the first click changes background color, but the second try Does not.