Force sub navbar to open

Hello
i am using v1
i have 3 tabs in sub navar
i am trying to force open second tab if the url contain X
i have added the class " active " to the second tab using js but it still doesnt open it …

if ( window.location.href.indexOf(‘tab-reviews’) > -1){
$(’#tab-reviews’).addClass(“active”)

}

i tried also to trigger a click
$( “#tab-reviews” ).click()

sorry i am new to js
thank you