You can do this:
if(url.split('?')[1].split('/')[1] == "user"){
$('#user').collapse(); // this is pseudo code
}
else{
$('#plan').collapse(); // this is pseudo code
}
Question
I have 2 different url which are:
And 2 accordion which have the id="user" and id="plan". Now I want to get the "plan" and "user" between the 2 slash in the url to identify which section I'm in and to let accordion decide which will be collapses.
Example: if I'm in user section, the accordion which had id="plan" will be collapse.
Is it possible to do that? Or have any better way to identify which accordion must be collapsed? Thank you so much.
La solution
You can do this:
if(url.split('?')[1].split('/')[1] == "user"){
$('#user').collapse(); // this is pseudo code
}
else{
$('#plan').collapse(); // this is pseudo code
}