<p id="elem" value=" <?php echo $_SESSION['variable']; ?> "></p>
The result of this operation is:
<p id="elem" value="0"></p>
For the time being, it is the expected result.
The problem is that when wanting to handle the new
console.log(elem.value); >> undefined