Search for element with matching content

by Akram kamal

HTML

<ul class="one">
	<li>Chelsea</li>
	<li>Man City</li>
	<li>Asernal</li>
    <li>Corn</li>
</ul>

<ul class="two">
	<li>Cheilsea</li>
	<li>Man Ccity</li>
	<li>Aserfnal</li>
    <li>Corn</li>
</ul>

<div class="show-here">mmm</div>

CSS

ul, li {

    margin: 0;
    padding: 0;

}

ul {
    margin: 25px;
}

ul:first-of-type {
    background:orange;
    width: 150px;
}

ul:last-of-type {
    background:green;
    width: 150px;
}

li {
    border-bottom: solid 1px white;
    display: inline-block;
    width: 100%;
    padding-left: 10px;
}

JavaScript

$(document).each(function() {

    var pMatch = $('.one li').map(function(){ 
        return $(this).text()
    })
var sMatch = $('.two li').map(function(){ 
        return $(this).text()
    })
console.log(pMatch,sMatch)
$.each(pMatch,function(i,p){
    if (p===sMatch[i])
        console.log("match")
    else
        console.log("no match")
})
if ($(pMatch === sMatch)) {
      
    $('.show-here').text('This is Working');
  }
    else {
        
    $('.show-here').text('This is not Working');
}
    
});