Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with jquery tabs
    primarykey
    data
    text
    <p>I need to know how to link (via a regular href anchor on a different page) to content that is inside a tab that is not the default tab. Can this be done? My code will explain hopefully what I require:</p> <p>My Code:</p> <h2>The following is my profile_edit.php page:</h2> <p>The javascript:</p> <pre><code>&lt;script src="Javascript/jquery-1.4.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; $(function () { var tabContainers = $('div.tabs &gt; div'); tabContainers.hide().filter(':first').show(); $('div.tabs ul.tabNavigation a').click(function () { tabContainers.hide(); tabContainers.filter(this.hash).show(); $('div.tabs ul.tabNavigation a').removeClass('selected'); $(this).addClass('selected'); return false; }).filter(':first').click(); }); $(function () { var tabs = []; var tabContainers = []; $('ul.tabs a').each(function () { // note that this only compares the pathname, not the entire url // which actually may be required for a more terse solution. if (this.pathname == window.location.pathname) { tabs.push(this); tabContainers.push($(this.hash).get(0)); } }); // sniff for hash in url, and create filter search var selected = window.location.hash ? '[hash=' + window.location.hash + ']' : ':first'; $(tabs).click(function () { // hide all tabs $(tabContainers).hide().filter(this.hash).show(); // set up the selected class $(tabs).removeClass('selected'); $(this).addClass('selected'); return false; }).filter(selected).click(); }); &lt;/script&gt; </code></pre> <p>The html and PHP (a portion):</p> <pre><code>&lt;div class="tabs"&gt; &lt;ul class="tabNavigation"&gt; &lt;li&gt;&lt;a href="#account_div"&gt;Account&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#change_password_div"&gt;Password&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#favorites_div"&gt;Favorites&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#avatar_div"&gt;Avatar&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="account_div"&gt; &lt;?php include("personal_info_edit.php"); ?&gt; &lt;/div&gt; &lt;div id="change_password_div"&gt; &lt;?php include("change_password.php"); ?&gt; &lt;/div&gt; &lt;div id="favorites_div"&gt; &lt;?php include("favorites.php"); ?&gt; &lt;/div&gt; &lt;div id="avatar_div"&gt; &lt;?php include("avatar.php"); ?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The following is contained in my change_password_submit.php page:</p> <pre><code>$update_pass= ("Password changed successfully."); header("location:profile_edit.php?update_pass=$update_pass#change_password_div"); exit(); </code></pre> <p>By default, whenever profile_edit.php is loaded, the personal_info_edit div is shown and the others are hidden. What do I need to change in the code so that I can reference the 2nd div (ie. change_password div and hide the rest after someone changes their password? Any help will be greatly appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload