消防按钮动作然后隐藏

时间:2014-07-09 08:24:00

标签: javascript jquery jsf-2

我有一个textarea元素onfocus三个按钮出现,然后onblur这些按钮假设隐藏(display = none),我的问题是当我点击三个按钮中的任何一个时,它们隐藏在触发动作之前,我需要按钮来执行动作onblur并隐藏。

 <h:inputTextarea styleClass="mmagd_2sms_create_template_erea toeditsavedtemp"
        value="#{bean.text}" onfocus="tempTextFocus(this)" id="temp-text" />
        <ul class="actionsList flipped buttontosavetemp">

            <li class=""><h:commandLink styleClass="overlayClose"
                             value="#{msgs.delete}" onclick="hideEditTemp(this)"
                             action="#{templateBean.deleteTemplate}">
                                 <f:setPropertyActionListener target="#{templateBean.templateDelObj}" value="#{bean}" />
                                 <f:ajax execute=":template-form"
                                 render=":template-form:user-temp-list" event="action" />
                        </h:commandLink></li>
            <li class=""><h:commandLink styleClass="overlayClose black" value="#{msgs.cancel}"
                             onclick="hideEditTemp(this)">
                             <f:ajax />
                        </h:commandLink></li>

            <li class=""><h:commandLink value="#{msgs.save}"
                             styleClass="overlayClose active"
                             action="#{templateBean.editTemplate}" onclick="hideEditTemp(this)">
                             <f:setPropertyActionListener target="#{templateBean.templateObj}" value="#{bean}" />
                             <f:ajax execute=":template-form" render=":template-form:user-temp-list" />
                        </h:commandLink></li>
        </ul>

1 个答案:

答案 0 :(得分:0)

你必须使用大纲脚本,在脚本标签,页面中使用jQuery或js事件处理程序,然后使用回调函数,它将在执行fire事件后执行,我使用另一个事件处理程序...

Read here about callback function

这个例子可以帮助你

$("textarea").focus(function () {
   // Execute fire action on foucse
}).blur(function () {
   // After finshed do Some code here
});

在示例中我没有使用回调,因为你的触发器是重点,如果你改变你的事件你可以使用回调

相关问题