I'm painting HTML%% of PHP and I need to handle it with JavaScript.
html.php
<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 $_SESSION['variable']
with JavaScript, it returns an error value="0"
.
javascript.js
console.log(elem.value);
>> undefined