【发布时间】:2015-12-08 17:31:46
【问题描述】:
我的 _form.gsp 中的单选按钮编码为
<table>
<thead>
...
</thead>
<tbody>
<g:each in="${locationList}" status="i" var="location">
<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
...
<td><g:radio name="location" value="${location.id}" onclick="showLocInfo(this)" checked="${false}" /></td>
</tr>
</g:each>
</tbody>
</table>
我隐藏的 div 是
<div id="locationTable" style="display: none">
<table style="width: 100%;">
<tr>
<td>HERES LOCATION INFORMATION</td>
</tr>
</table>
</div>
我的 create.gsp 的头部包含一些当前无法正常工作的 javascript
<head>
...
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript">
$(function() {
$(".datepicker").datepicker();
});
jQuery.noConflict();
function showLocInfo(elem){
if (elem.checked == "true") {
document.getElementById('locationTable').style.display = "block";
}
if (elem.checked == "false") {
document.getElementById('locationTable').style.display = "none";
}
}
</script>
</head>
日期选择器有效,但显示位置信息功能无效。我做错了什么?
【问题讨论】:
标签: javascript jquery html grails