JSFiddle - React, Tailwind, and code Playground

by Gregory Nikitas

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<a href='#' class="hotel" data-hotel-name='Holiday Inn'>Add to favourites</a>
<a href='#' class="hotel" data-hotel-name='Hilton'>Add to favourites</a>
<a href='#' class="hotel" data-hotel-name='Motel'>Add to favourites</a>

<div id="hotel-box">
<!-- add the hotel names here -->
</div>

JavaScript

var hotelName = [];    
$('.hotel').on('click', function(e){
    e.preventDefault();    
    hotelName.push( $(this).data('hotel-name') );
		
     var html = '<ul style="background-color: green">';
    jQuery.each($.unique(hotelName.sort()), function(index, item) {
                html += '<li>something ' + item + '</li>';
    });

    html += '</ul>';
    $('#hotel-box').html(html);

    console.log(hotelName);

});