How to add css class in JQuery

nedash
 
on Jul 25, 2016 05:01 AM
2314 Views

hi

below code is for java:

  <script type="text/javascript">
        $(function () {
            var selctedMenuHtml = localStorage.getItem('SelectedMenu');
            var selectedMenu = $.grep($('[id*=MM21] ul a'), function (ele) {
                return $(ele).html().trim() == selctedMenuHtml.trim();
            }).pop();
            $(selectedMenu).addClass('SelectedActiveMenu');
            $(selectedMenu).focus();
        });
    </script>

I want put below css for

$(selectedMenu).focus();

this is css:

.parent {
    text-align:center;
    background-color:blue;
    height:400px;
    width:600px;
}

how I can put above css for

$(selectedMenu).focus();

best regards

neda

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jul 25, 2016 05:02 AM

Check with the below code.

$(selectedMenu).addClass('parent');
$(selectedMenu).focus();