Make Reference Toggle Bold On Click in PHP
<p>I am trying to make a reference tag toggle bold when clicked. I know there are many examples online and i tried most of them but i keep getting this error: </p>

<pre><code>Uncaught TypeError: Cannot read property 'click' of null
</code></pre>

<p>I am writing everything in PHP (I have my reasons) and here is the code:</p>

<pre><code>print "&lt;script type=\"text/javascript\"&gt;\n";
echo &lt;&lt;&lt;JS

$(".boldtrigger").click(function(){
    $(".boldtrigger").toggleClass("bold");
});
JS;

/*Now for Html Part*/
echo "&lt;tr class = 'oddkill' &gt;&lt;td class = 'entry_cell' &gt;&lt;a href = \"javascript: displayRow('context_row_${row_paridy}') \" class = 'boldtrigger' style = 'color:black'&gt;$test&lt;/a&gt;&lt;/td&gt;";
</code></pre>

<p>I have the css in another file:</p>

<pre><code>.bold {
    font-weight: bold;
}
</code></pre>

<p>I don't understand why it thinks that the 'boldtrigger' class doesn't exist. Can someone help?</p>