I want my code to fade text in and out using setInterval function in JavaScript. Currently it will only run my first piece of text and then keeps repeating the last bit over and over again. I'm not sure if it's JavaScript or my html.
<div class="col-md-3">
<h3 id="RickQuotes" class="text-center">Rick "C137" Sanchez</h3><br />
<h4 class="fade1">Hello</h4>
</div>
<script>
setInterval(function() {
$('h4').fadeOut(1000, function() {
var $this = $(this);
$this.text($this.text() == ' Hello' ? 'Rick and Morty' : '.......');
$this.toggleClass('fade1');
$this.fadeIn(1000);
});
}, 3000);
</script>