So, basically I am trying to pass a variable to a piece of javascript code and then in turn set this value as a hidden input value.
<img alt="" src="Image.jpg" style="width:50px" class="thisclass" title="Title" onclick="thisfunction('Text Here')" />
The value clearly passes okay as I am able to process it with a switch command successfully.
function thisfunction(thisvariable) {
switch(thisvariable) {
case 'Text Here' :
However, when I try to set the value of a hidden
<input type="hidden" name="ThisInput" value="N/A" />
document.getElementById("ThisInput").value = thisvariable;
I get the following error in the javascript console
Uncaught TypeError: Cannot set property 'value' of null
I have also tried
$('#ThisInput').val(thisvariable);
However this just seems to blank the value.