jQuery events- show事件在firefox中不能正常工作

时间:2015-04-05 13:33:18

标签: jquery firefox javascript-events click

我必须在点击事件上显示一个按钮。

我正在使用以下代码:

$('.message-interaction textarea').on('click',function(e){
    e.stopPropagation();
    $(this).css('height','90px');
    $('.message-interaction .message-edit .button-blue').show();
})

HTML代码:

<g:form action="reply" id="${conversationInstance.id}">
                        <div class="convo-body">
                        <textarea class="reply input-text-big" rows="1" name="message" placeholder="Send a reply"></textarea>
                        </div>
                    <div class="mt-16">
                        <button type="submit" class="pull-right button-blue" disabled>Send</button>
                </div>
                    </g:form>

由于某种原因,只需点击2次即可显示该按钮。

1 个答案:

答案 0 :(得分:0)

它适用于我的Firefox:

<!DOCTYPE html>
<html>
   <head>
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
      <script>
         $(document).ready(function(){
         $('textarea').on('click',function(e){
             e.stopPropagation();
             $(this).css('height','90px');
             $('.mt-16 .button-blue').show();
         })
         });
      </script>
   </head>
   <body>
      <div class="convo-body">
         <textarea class="reply input-text-big" rows="1" name="message" placeholder="Send a reply"></textarea>
      </div>
      <div class="mt-16">
         <button type="submit" style="display: none" class="pull-right button-blue" disabled>Send</button>
      </div>
   </body>
</html>