开发者

rich:jQuery not working on JS call

开发者 https://www.devze.com 2023-01-12 23:17 出处:网络
I have richfaces application. In the page, there is jQuery function defined: <rich:jQuery timing=\"onJScall\" name=\"updateUrlHash\" selector=\"#conversationId\"

I have richfaces application. In the page, there is jQuery function defined:

<rich:jQuery timing="onJScall" name="updateUrlHash" selector="#conversationId" 
    query="alert('in jquery call');" />

Then I have some a4j:commandLink, which should call the function on completing ajax request.

开发者_运维百科
<a4j:commandLink value="test" oncomplete="updateUrlHash(this)" />

Unfortunately, it does not work. I know oncomplete works, because if I put there alert('test');, alert is shown. But when I try to call updateUrlHash function, it does not work. I checked in page source that function is there. What can be wrong?


I found it. Query is called on object selected by jQuery selector. So in example like this, in javascript is it

jQuery(selector).alert('in jquery call');

This of course cannot work. So I need to call anything on selected element, and then I can do what I want:

query="hide(); alert('this works');"

In Javascript it is then (selected element is hidden anyway):

jQuery(selector).hide(); alert('this works');
0

精彩评论

暂无评论...
验证码 换一张
取 消