It seems submitted["+comp_name+"]
is the name
of your element, but in javascript we don't have document.getElementByName
, but you can do it like:
document.querySelector("input[name='submitted["+comp_name+"]']").value = id;
or using jQuery do:
$("input[name='submitted["+comp_name+"]']").val(id);
but if submitted["+comp_name+"]
is the id
do this:
document.getElementById("submitted["+comp_name+"]").value = id;
or using jQuery:
$("#submitted["+comp_name+"]").val(id);