无法读取JSF组件上的ID [英] Can Not Read id on JSF Components

查看:129
本文介绍了无法读取JSF组件上的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一点问题
我正在尝试在JSF textarea组件上使用MartkItUp JQuery富文本编辑器。
我的表格如下所示:

I have a little problem I am trying to use MartkItUp JQuery rich text editor on JSF textarea component. My form looks like this:

 <h:form id="comment">
    <h:inputTextarea id="commentBody" cols="10" rows="10" value="#{postComment.commentBody}" required="true" requiredMessage="Comment Body is reqguired" >
      <f:validateLength maximum="500" minimum="2" />
    </h:inputTextarea>
                <%-- more of the form... %-->

问题是在输出时它给了我textarea的id

The problem is that on output it gives me the id for textarea like that

id="comment:commentBody"

当我尝试在JQuery中指出它没有任何反应时。

When I try in JQuery to point to it nothing happens.

$('#comment:commentBody').markItUp(mySettings);

之前我有一个简单的textarea,没有问题。现在,我有很多。

I had a plain textarea before, and there was no problem. Now, I have a lot of them.

我如何在JQuery中指向id,这看起来像评论:commentBody

How do I point to id in JQuery, thats looks like comment:commentBody

PS:我知道我可以用$('textarea')指向这个文本区域.markItUp(mySettings);但是我正在寻找通过它的ID指向特定文本区域的解决方案。

P.S: I know i can point to this text area by $('textarea').markItUp(mySettings); however i am looking for solution to point to specific text area by it's ID.

推荐答案

试试这个, $('#comment \\:commentBody'),适用于JQuery 1.1.3或更高版本。

Try this, $('#comment\\:commentBody'), for JQuery version 1.1.3 or greater.

这篇关于无法读取JSF组件上的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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