need some help building the logic syntax for this JQUERY condition.
if the current url window includes a specific $string (index.php) then i want to add a value to a specific <li> class. as seen below.
<ul class="nav">
<li>...</li>
<li>index</li>
</ul>
this is the target element
('.nav li:nth-child(2) ').addClass("selected").
this is my jquery. im not quite sure how to code the correct syntax for my logic.
$j(function(){
var url = window.location.pathname;
var string = 'index.php';
if //current url has $string ('index.php') {
$j( ".nav li:nth-child(2)" ).addClass( "active" );
});
});