如何获取Struts2复选框列表的ID [英] How to get the id of struts2 checkboxlist

查看:64
本文介绍了如何获取Struts2复选框列表的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个struts2复选框,如

I''ve a struts2 checkboxlist as,

<s:checkboxlist list="{''Mon'',''Tue'',''Wed'',''Thur'',''Fri'',''Sat'',''Sun''}" name="processVO.weeklyCal" id="days" disabled="true"/>


但是我没有得到我指定的ID"days".当我签入页面源代码时,id显示为processVO.weeklyCal-1到processVO.weeklyCal-7.因此,我无法编写使用id"days"启用/禁用复选框列表的jQuery函数.我该如何解决?请帮助

谢谢


But I''m not getting the id ''days'' as I specified. id is showing like processVO.weeklyCal-1 upto processVO.weeklyCal-7, when I checked in page source. So I''m not able to write the jQuery function to enable/disable the checkboxlist using the id ''days''. How can I solve this? Pls help

Thanks

推荐答案

hi--

使用getElementById函数.您的情况:

hi--

use the getElementById function. in your case:

var days = document.getElementById("days");


默认情况下,复选框列表使用元素 name 作为 id 作为复选框和标签.
您必须使用自定义主题,然后编辑checkboxlist.ftl文件.

您需要在两个地方进行更改:

1:默认值:
By default checkboxlist uses the element name as id for the checkbox and label.
You have to use custom theme, and edit the checkboxlist.ftl file.

you need to make changes at two places:

1: default:
<input type="checkbox" name="


{parameters.name?html}" ="
{parameters.name?html}" value="


这篇关于如何获取Struts2复选框列表的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆