Search for element with matching content
Here is what I'm trying to achieve:
For each
li in
.one , search for
li's in
.two that has matching content, and then wrap them both in div. Any Ideas on how I can achieve this?
Below is my code so far.
- $(document).each(function() {
- var pMatch = $('.one li').contents();
- var sMatch = $('.two li').contents();
- if ($(pMatch === sMatch)) {
-
- $('.show-here').text('This is Working');
- }
- else {
-
- $('.show-here').text('This is not Working');
- }
-
- });
Here is a link to jsfiddle with the code.