use span value in js code example
Example 1: how to get value inside span using javascript
var span_Text = document.getElementById("span_Id").innerText;
console.log(span_Text)
Example 2: how to get value inside span using javascript
<script type="text/javascript">
document.getElementById('button1').onChange = function () {
document.getElementById('hidden_field_id').value = document.getElementById('span_id').innerHTML;
}
</script>