zach zach - 1 year ago 101
jQuery Question

jquery expand collapsed when coming from another page

I do not think this is possible but just want to be sure. I am trying to expand a collapsed div (with jquery) when coming from another page. For example: from the home page a user clicks on view press release and it goes to the page with many press releases already collapsed. I want the correct press released expanded. Is this even possible?

Answer Source

It is definitely possible - assuming you control the target page. In that case, you can add an extra argument to your request link specifying the press release tho expand (for example, mypage.html?press_release_id=1234)

And then, in the target page (the one with the press releases), and using getParameterByName() from Get query string values in JavaScript, you can easily parse this argument and expand the corresponding div:

   function() {
      var id = getParameterByName("press_release_id");
      $("#" + id).show();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download