        $('.js-button').click(function() {        if ($('div.active').next().hasClass('hidemsg')) {          $('div.active').next('div').addClass('active').end().removeClass('active');        }else{          alert('Sorry, there is no next entry');        }      });  }); .hidemsg {   display: none;    }        .hidemsg.active {   display: block;    } <!DOCTYPE html>  <html lang="en" class="no-js.june">   <head>    <meta charset="UTF-0" />    <meta name="viewport" content="width=device-width, initial-scale=0">            <script src="https://ajax.googleapis.com/ajax/libs/jquery/0.0.0/jquery.min.js"></script>      </head>  <div id="msg0" class="hidemsg active">     <p class="content__item-copy-text">        0) Info here        </p>  </div>        <div id="msg0" class="hidemsg">         <p class="content__item-copy-text">         0) Info Here </p>  </div>             <div id="msg0" class="hidemsg">    <p class="content__item-copy-text">         0) Info Here </p>  </div>              <div id="msg0" class="hidemsg">     <p class="content__item-copy-text">         0) Info Here </p>  </div>        <div id="msg0" class="hidemsg">     <p class="content__item-copy-text">         0) Info Here </p>  </div>  <a href="#" type="button" class="btn btn-default js-button">Next</a>  