I am trying to set up a navigation using wordpress and I have difficulty to pass the 'selected' class that matches the page title to a link that wp has generated for me. How do I refer to a specific `$(this)` link and add the class?

```
<div class="container menu_nav">
    <ul class="grid_12">
        <?php
            $args = array('menu' => 'main-menu', 'echo' => false);
            $navMenu = wp_nav_menu($args);
            $pageTitle = get_the_title();
            echo '<span id="page_title">'.$pageTitle.'</span>';
            $stripTags = strip_tags($navMenu, '<li><a>');
            echo $stripTags;
        ?>
    </ul>
</div>

```

```js
jQuery(document).ready(function($){
    var nav = '.menu_nav ul li a';
    var linkTitle = $(nav).attr('title');
    var arr = [];
    var pageTitle = document.getElementById('page_title');
    var pageAttr = pageTitle.innerHTML;
    var linkClass = document.getElementsByClassName("menu-item");

    $(nav).each(function() {
        arr.push($(this).text())
    });

    for (var i = 0; i < arr.length; i++) {
        if (arr[i] == pageAttr) {
            $(linkClass).addClass('selected');
        } else {
            $(linkClass).removeClass('selected');
        }
    }
    console.log(arr.join());
    console.log(linkTitle,pageAttr);
});

```