So from the home page, i have a link that goes to a products listing page. The product page has expand/collapse divs.
I need the appropriate div to expand depending
You can use the hash
property of the Location
object, try the following:
$(document).ready(function(){
var id = window.location.hash;
$(id).trigger('click')
})
As you are using jQuery instead of using javascript:
protocol, you can use the jQuery click
method:
$('#healthysnacks').click(function() {
// do something here
})