I am trying to do the following:
<html>
<script type="text/javascript" src="jquery.js"></script>
<a id="random">before</a>
<script>
function test(a)
{
document.getElementById('random').innerHTML="after with variable passed in";
}
function test2()
{
document.getElementById('random').innerHTML="after without variable passed in";
}
</script>
<?php $sample = "hi"; ?>
<button onClick="test(<?php echo $sample;?>)">withVariable</button>
<button onClick="test2()">withoutVariable</button>
</html>
If I click the "withoutVariable" button, the function test2() gets called perfectly because no variables are passed in to it. However, if I click the "withVariable" button the function test(a) is never being called for some reason. Any ideas what I'm doing wrong here?