JSFiddle - React, Tailwind, and code Playground

by Santosh Thakur

HTML

<div>Hotel Detail Js</div>

JavaScript

function AverageRateForStarFilter() {
    var avgList = model.HRAP.split('~');
    var idy = 0;
    for (var idx = 2; idx <= 5; idx++) {

        if (avgList[idy] > 0)
            $('#spnAvg' + idx).attr('title', avgList[idy]).html(avgList[idy]);
        else {
            $('#avgRtPrice' + idx).hide();

        }
        idy++;
    }
}
function SelectStarRating(elemid, ischk) {
    if (ischk == 't') {
        $('#chkStarRating' + elemid).attr('checked', true);
    }
    else if (ischk == 'f') {
        $('#chkStarRating' + elemid).attr('checked', false);
    }
    if ($('#chkStarRating' + elemid).is(":checked")) {
        $('#sup'+ elemid).show();
        $('#liAvgRtPrice' + elemid).attr('class', 'avrgSelected');
    }
    else {
        $('#liAvgRtPrice' + elemid).attr('class', '');
        $('#sup' + elemid).hide();
    }
    model.clickRemove = true;
    model.FilterHotelResults(true);
}

$('.ratingChk input').click(function () {
    if ($(this).is(':checked'))
        $('#liAvgRtPrice' + $(this).val()).addClass('avrgSelected').find('sup').show();
    else
        $('#liAvgRtPrice' + $(this).val()).removeClass('avrgSelected').find('sup').hide();
})

function ChangeRatingonLoad() {
    $('.ratingChk input').each(function (i) {
        if ($(this).is(':checked')) {
            $('#liAvgRtPrice' + $(this).val()).addClass('avrgSelected').find('sup').show();
        }
        else {
            $('#liAvgRtPrice' + $(this).val()).removeClass('avrgSelected').find('sup').hide();
        }

        if (parseInt($(this).parent().find('#strCtr' + $(this).val()).text()) == 0) {
            $('#liAvgRtPrice' + $(this).val()).hide();
        }
    })
    var count = $('#divStarAvgRates li').not(":first").filter(function () {
        if ($(this).is(":visible"))
            return $(this);
    });
    if (count.length < 1)
        $('#divStarAvgRates').hide();
}
setTimeout(ChangeRatingonLoad, 500);

function Stringify(jsonData) {
    var strJsonData = '{';
    var itemCount...