Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

delete inform message does not disappear immediately

jackmaessenjackmaessen ✭✭✭
edited February 2015 in Vanilla 2.0 - 2.8

I noticed when making a message (casual, info, alert ...) and you want to dismiss this message by clicking on the cross in the upper right corner, it only disappears after a page refresh. I searched for this message and it is echoed in the class"DismissMessage" in applications\dashboard\views\modules\message.php

if (is_array($Message)) {
   echo '<div class="DismissMessage'.($Message['CssClass'] == '' ? '' : ' '.$Message['CssClass']).'">';
   $Session = Gdn::Session();
   if ($Message['AllowDismiss'] == '1' && $Session->IsValid()) {
      echo Anchor('×', "/dashboard/message/dismiss/{$Message['MessageID']}/".$Session->TransientKey().'?Target='.$this->_Sender->SelfUrl, 'Dismiss');
   }

So the content is in the class"DismissMessage" and the anchor (x) is in the class :"Dismiss".
I made this javascript for it to delete it immediately after click but it seems not to work:

$("a.Dismiss").click(function () {
      $("div").remove('.DismissMessage');
    $("a").remove('.Dismiss');
    });

I don't know what i am doing wrong...

When making a jsfiddle of it, it does work:
http://jsfiddle.net/sKeW5/94/

Comments

  • hgtonighthgtonight ∞ · New Moderator

    It happens immediately for me on my forums.

    Do you have any JS errors in your console?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • no i do not have any javascript errors. Even when i add the script via firebug under the anchor it does not work. Only after refresh.Strange.... can not explain this

  • jackmaessenjackmaessen ✭✭✭
    edited February 2015

    Found the solution: i added the ready handler and now it works immediately!

    $(document).ready(function () {
        $("a.Dismiss").click(function () {
          $("div").remove('.DismissMessage');
          $("a").remove('.Dismiss');
        });
    });
    
Sign In or Register to comment.