JSFiddle - React, Tailwind, and code Playground

HTML

<div id="message"></div>
			<div id="content">
                
			</div>
			
			<nav>
				<ul>
					<li><a href="http://google.fr">Google</a></li>
					<li><a href="http://yahoo.fr">Yahoo</a></li>
					<li><a href="http://tf1.fr">Tf1</a></li>
				</ul>
			</nav>

JavaScript

$(document).on('click','nav ul li a',function(e){
        e.preventDefault();
        var cloneLink = $(this).clone(); 
        var attrActive = $(this).attr('href');
        var length;   
        length = $('#content').children('a[href="'+attrActive+'"]').length;

            if(length == 1){
                $('#message').html("pas bon");
            }
            else {
                $('#content').last().append(cloneLink); 
            }

        
    });