I'm using Grails 1.3.7 and jQuery Mobile. I need to execute the following Javascript to initialize a select for a specific page but firebug confirms that this code is not being included when the page is rendered even though g:layoutHead in the layout is rendering the meta and title tags that are also in the head for this page.
<g:javascript>
var zselect = document.getElementById('tee')
var zopt = zselect.options[zselect.selectedIndex]
</g:javascript>
Any idea why the script is not being rendered?
The head of my layout has the jQuery and jQuery Mobile includes as well as the jQuery UI datepicker and fluid960. Here's the end of the layout head:
<g:layoutHead/>
</head>
Here's the head of the view from which the meta and title tags are rendered but not the javascript.
<head>
<g:javascript>
var zselect = document.getElementById('tee')
var zopt = zselect.options[zselect.selectedIndex]
</g:javascript>
<meta name="layout" content="main">
<g:set var="entityName" value="${message(code: 'foursome.label', default: 'Foursome')}"/>
<title><g:message code="default.create.label" args="[entityName]"/></title>
</head>