I don't feel this is a good method to do it. By enabling <f:verbatim> parsing would not happen when the page gets rendered, so EL expression would be off. (Always <script> should not be parsed as a best practice).
Try save the bean value in hidden input box, then extract by java script function call. Here you have used faces input box <h:inputHidden> with id attribute, but faces will be given different id value than what you have specified.
Create input hidden box inside 'div' or 'span' and extract them by (div.id/span.id).firstChild. This should work for you.