Instead:
newVal = document.getElementById('y257y').getValue();
try using:
newVal = document.getElementById('y257y').innerHTML;
Are you using any JavaScript library like jQuery or Prototype? If you are using jQuery:
newVal = $('#y257y').html();
Other offers:
Use a hidden form element:
echo "<input type=hidden id=y257y value=\"$fdesc\">";
and in JavaScript:
newVal = document.getElementById('y257y').value;
Or just print the tag <script>:
echo "<script>newVal = \"$fdesc\";</script>";
and there is no need to find the value in the DOM - this is already in JavaScript.
source
share