javascript - Having trouble with assigning a PHP echo varible to document.getElementById
Get the solution ↓↓↓This works: note-($i = 1)
document.getElementById("range1").setAttribute("value", javascript_array[<?php echo $j++; ?>]);</script>
<p><input type="text" name="range<?php echo $i; ?>" id="range<?php echo $i; ?>" />
This does not work:
document.getElementById("range").setAttribute("value", javascript_array[]);
input type="text" name="range" id="range" />
If I replace "range1" with "range" /not working/
I have read allot and tried several options (+, &, move the "" around) to add to that location but will not work. If I put in "range1" works but not "range". I have the PHP echo in other locations and it works: "value",.., <input type.. name=, id="range<?...
I tried this too and didn't work: var rangex = "range" + ; alert(rangex);
document.getElementById(rangex).setAttribute("value", javascript_array[<?php echo $j++; ?>]);</script>
<p><input type="text" name="range<?php echo $i; ?>" id="range<?php echo $i; ?>" />
The alert does come up with "range1" but still will not work. Not sure why StackOF is cutting off the "does not work code"? Thank you for any help!
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot add or update a child row: a foreign key constraint fails
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.