I've got some HTML code that looks like this:
HTML:
<INPUT TYPE=CHECKBOX NAME="clcik" onClick="add('1234','blah')" />
<input type="hidden" id="project" value="" />
JS:
function add(obj1 , obj2){
var jsonArray = [];
var jsonObj = { product_id : obj1 , name : obj2 };
jsonArray.push(jsonObj);
var field = document.getElementById('project');
field.setAttribute('value', JSON.stringify(jsonArray));
alert(field.getAttribute('value'));
}
I'm attempting to set a value and then retrieve it again for testing purposes, but I'm not seeing any changes. I'm puzzled as to where I may have gone wrong...?