我刚刚通过w3schools教程JQuery。我试图在seam/richfaces应用程序中写一个函数。我有一个搜索图标和onclick搜索图标,我想切换UI中的某些字段。但没有任何反应,我没有看到萤火虫的任何错误。请帮忙。基本的jQuery问题
<rich:dataTable id="acctListTbl" value="#{accounts}" var="account" width="100%">
<rich:column>
<f:facet name="header">
<h:panelGroup>
<h:graphicImage id="srchIcon" value="/images/search_icon.png"
styleClass="search-icon"/>
<h:outputText value="Action" />
</h:panelGroup>
</f:facet>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#acctListTbl:srchIcon").click(function(){
jQuery('.search-field').toggle();
});
});
</script>
这里是html。正如user914670指出的那样,我的搜索图标呈现中没有添加jQuery处理程序。那么,什么是错的?
<div id="j_id12:acctListTbl:j_id31header:sortDiv">
<img id="j_id12:acctListTbl:srchIcon" class="search-icon"
src="/xxxx/images/search_icon.png">
Action
</div>
你可以显示呈现的HTML而不是生成它的服务器端代码吗? – lonesomeday
我没有看到类.search-field –
的元素我不推荐使用w3schools作为jQuery资源。 http://w3fools.com –