JavaScript Dropdown is reloading home page on click

I am using a drop down for some additional content. I am not sure why but the drop down isn't working properly. When clicked on the 'read more' link it takes me back to my home page or refreshes to the home page. I made a jsfiddle and it's doing the same there. Any info on what I am doing wrong would be appreciated.

$('.expand-notice').on('click', function(e) {
    e.preventDefault();
    var parent = $(this.parentNode.parentNode);
    parent.toggleClass('open-notice');
    if (parent.hasClass('open-notice')) $(this).text('Less');
    else $(this).text('Read more');
  });
.notice {
  background: #DDDDDD;
  max-width: 40em;
  margin: 0 auto 0.5em;
  padding: 1em;
  text-align: center;
  font-family: sans-serif;
  letter-spacing: 1px;
}
.notice p {
  margin: 0;
}
.notice-type,
.notice-title {
  font-family: sans-serif;
}
.notice-type {
  text-transform: uppercase;
  opacity: 0.8;
  font-size: 11px;
  letter-spacing: 2px;
}
.notice-title {
  font-size: 20px;
}
.notice-content {
  display: none;
  text-align: left;
  margin: 5px;
}
.notice-content p {
  letter-spacing: 0;
  padding: 5px;
}
.open-notice .notice-content {
  display: block;
}

.recent-news {
  margin: 0em auto;
  max-width: 80em;
  padding: 0 3% 2em;
  overflow: hidden;
  text-align: center;
}
.recent-news h2 {
  margin-top: 0.5em;
}

.news-item {
  display: inline-block;
  margin: 1.5em 0 0 0;
  width: 47.75%;
  background: #fff;
  padding: 2em 0em;
  text-align: center;
  vertical-align: top;
}
.news-item:nth-child(2n) {
  margin-left: 3%;
}
.news-item p {
  padding: 0em 1.5em;
  margin: 0em;
  line-height: 1.6;
}
.news-item p.news-date {
  font-size: 0.95em;
}
<div class="page" data-subject-page="1">
  <div class="largeText" data-subject-text="">
    <div class="recent-news">
    <h1>main title</h1>
      <div class="notice">
      <p class="notice-type">Date</a>
      <p class="notice-title">sub title</p>
        <div class="notice-content">
        <p>Content here</p>
        </div>
        <p><a target='_blank' href="/" class="expand-notice">Read more</a></p>
      </div>
    </div>
  </div>
</div>
Answer:1

Remove the href attribute from a tag and wrap the scripts into

$(document).ready()

Please see the fiddle

Answer:2

I wanted to use a custom contextmenu on right click, I found over internet. When I integrated that with my code, it is showing TypeError: $.contextMenu is undefined. I am actually using the jquery....

I wanted to use a custom contextmenu on right click, I found over internet. When I integrated that with my code, it is showing TypeError: $.contextMenu is undefined. I am actually using the jquery....

  1. what could possibly go wrong
  2. what could possibly go wrong meme
  3. what could possibly go wrong gif
  4. what could possibly go wrong lyrics
  5. what could possibly go wrong bubsy
  6. what could possibly go wrong book
  7. what could possibly go wrong meaning
  8. what could possibly go wrong with an old fashioned
  9. what could possibly go wrong simpsons
  10. what could possibly go wrong civ 6
  11. what could possibly go wrong jeremy clarkson
  12. what could possibly go wrong song
  13. what could possibly go wrong jodi taylor
  14. what could possibly go wrong sssniperwolf
  15. what could possibly go wrong tv show
  16. what could possibly occur when a vehicle is overloaded
  17. what could possibly be at the bottom of the ocean
  18. what could possibly go wrong twitter
  19. what could possibly go wrong bones
  20. what could possibly go wrong compilation

I am working with a form in which i take the password input from the user and then javascript checks if the passwords match. But even if the password is required, the form gets submitted if the input ...

I am working with a form in which i take the password input from the user and then javascript checks if the passwords match. But even if the password is required, the form gets submitted if the input ...

  1. how does this form a rainbow
  2. does this ion form
  3. does form 8300 trigger an audit
  4. does form mean in art
  5. does form in music mean
  6. does form factor mean

<span class="classname"> <img src="" width="70" height="70"> </span> I'm trying to add an anchor tag with a URL around the tags. I'm not sure how to do it and I've been stumped for ...

<span class="classname"> <img src="" width="70" height="70"> </span> I'm trying to add an anchor tag with a URL around the tags. I'm not sure how to do it and I've been stumped for ...

I am creating an ajax slider with only the one "slide" thats data reloads during slide. My current method is to animate the absolute positioned element out of parent viewport, jump to right hand side ...

I am creating an ajax slider with only the one "slide" thats data reloads during slide. My current method is to animate the absolute positioned element out of parent viewport, jump to right hand side ...