【问题标题】:Using rich:jquery without the selector在没有选择器的情况下使用 rich:jquery
【发布时间】:2014-10-17 01:16:27
【问题描述】:

下面是我为我的文本框设置 mash 值的代码。

<h:inputText id="time" value="#{configMaster.time}" style="width:40px;" maxlength="5">  
<rich:jQuery selector="#time" query="mask('99:99', {placeholder:' '})" timing="onload"/>  
</h:inputText>

但我的问题是我正在使用 &lt;c:forEach&gt; 之类创建动态文本框

<c:forEach items="#{maintTable.columnDataList}" var="col" varStatus="loop">
<h:inputText value="#{configMaster.time}" style="width:40px;" maxlength="5">  
<rich:jQuery query="mask('99:99', {placeholder:' '})" timing="onload"/>  
</h:inputText>
</c:forEach>

这里的问题是id 将是动态的,所以我不能给selector。有没有办法让它适用于我所有的文本框。提前致谢。

【问题讨论】:

    标签: jquery jsf-2 richfaces


    【解决方案1】:

    只需使用 CSS 类。

    <h:inputText ... styleClass="masked" />
    ...
    <rich:jQuery selector=".masked" ... />
    

    【讨论】:

    • 感谢 BalusC。如果我有 2 个样式类,那么我需要同时提供两个还是一个就足够了。 styleclass inputText 适用于所有文本框。但我希望 仅适用于具有distTime 样式类的文本框。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多