javascript - add class (current) on menu item if It has particular url -


i've have wordpress multisite. need add class (current) on menu item if tt has url:

www.mysite.com/clients 

i tried code doesn't work:

jquery(document).ready(function($){     var url = $(location).attr('protocol')+"//"+$(location).attr('host')+"/clients/";     $('li a[href="'+url+'"]').addclass('current_page_item'); }); 

since try modify html, should include html in post.

this wild guess i'm guessing solution:

$('a[href="'+url+'"]').addclass('current_page_item'); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -