Note that there are some explanatory texts on larger screens.

plurals
  1. POButton won't change tab in JQuery UI Tabs
    primarykey
    data
    text
    <p>I have a web page that has JQuery tabs with iFrames loaded in the 2nd through 4th tab. My problem is in a button I've added to the first tab. I want that button, when pressed, to change to the next tab. </p> <p>EDIT 1: Here is a fiddler that shows my problem. <a href="http://jsfiddle.net/lochalan/AXa9J/" rel="nofollow">http://jsfiddle.net/lochalan/AXa9J/</a></p> <p>Webpage: </p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Student Application&lt;/title&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"&gt;&lt;/script&gt; &lt;script src="/user/tabs.js" type="text/javascript"&gt;&lt;/script&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;style type="text/css"&gt; html { font-size:10px; } .iframetab { width:100%; height:auto; border:0px; margin:0px; position:relative; top:-13px; } .ui-tabs-panel { padding:5px !important; } .openout { float:right; position:relative; top:-28px; left:-5px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;table width="100%" cellpadding="0" cellspacing="0" border="0"&gt; &lt;tr&gt;&lt;td&gt; &lt;img src="img/logo960x100moodle.png" width="960" height="92" alt=""&gt;&lt;br&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;div id="tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#tabs-1"&gt;Instructions&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="tabref" href="#tabs-2" rel="/user/application-tab.php"&gt;Student Information&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="tabref" href="#tabs-3" rel="/user/emergency-tab.php"&gt;Emergency Contact&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="tabref" href="#tabs-4" rel="/user/healthform-tab.php"&gt;Health Form&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="tabs-1" class="tabMain"&gt; &lt;h2&gt;Welcome to QSI Shekou!&lt;/h2&gt; &lt;p&gt;This application is designed to give the school all the information needed to make an informed decision as to whether QSI is the best school for your child. We believe all children can be successful and we are proud that you have choosen QSI Shekou as that place. In the next few minutes, you will be presented with 3 seperate application forms. The first application gathers the needed biographical information about your child. The second form provides the school with emergency contact information and instructions in the event the school needs to contact someone on your child's behalf. The third form is our health form. This provides the school with information about your child's health in order to help us make QSI Shekou a fun and safe place to learn and grow.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Remember to give the following documents to the admissions department:&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Immunization records (copy)&lt;/li&gt; &lt;li&gt;Health / Emergency Form (Found on our Website)&lt;/li&gt; &lt;li&gt;Previous School Records (copy)&lt;/li&gt; &lt;li&gt;Student's Passport (copy)&lt;/li&gt; &lt;li&gt;Student's Visa (copy)&lt;/li&gt; &lt;li&gt;Mother's Passport (copy)&lt;/li&gt; &lt;li&gt;Mother's Visa (copy)&lt;/li&gt; &lt;li&gt;Father's Passport (copy)&lt;/li&gt; &lt;li&gt;Father's Visa (copy)&lt;/li&gt; &lt;li&gt;3 Student Passport Photos&lt;/li&gt; &lt;/ul&gt; &lt;button class="nexttab" href="#"&gt;&lt;strong&gt;Let's get started!&lt;/strong&gt;&lt;/button&gt; &lt;/div&gt; &lt;div id="tabs-2"&gt; &lt;/div&gt; &lt;div id="tabs-3"&gt; &lt;/div&gt; &lt;div id="tabs-4"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Javascript / JQueryUI:</p> <pre><code>$(document).ready(function() { var $tabs = $('#tabs').tabs(); $(".nexttab").click(function() { var selected = $("#tabs").tabs("option", "selected"); $("#tabs").tabs("option", "selected", selected + 1); }); //get selected tab function getSelectedTabIndex() { return $tabs.tabs('option', 'selected'); } //get tab contents beginTab = $("#tabs ul li:eq(" + getSelectedTabIndex() + ")").find("a"); loadTabFrame($(beginTab).attr("href"),$(beginTab).attr("rel")); $("a.tabref").click(function() { loadTabFrame($(this).attr("href"),$(this).attr("rel")); }); //tab switching function function loadTabFrame(tab, url) { if ($(tab).find("iframe").length == 0) { var html = []; html.push('&lt;div class="tabIframeWrapper"&gt;'); html.push('&lt;div class="openout"&gt;&lt;a href="' + url + '"&gt;&lt;img src="data/world.png" border="0" alt="Open" title="Remove iFrame" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;iframe class="iframetab" src="' + url + '"&gt;Load Failed?&lt;/iframe&gt;'); html.push('&lt;/div&gt;'); $(tab).append(html.join("")); $(tab).find("iframe").height($(window).height()-80); } return false; } }); </code></pre> <p>Why won't my button change the tab?</p>
    singulars
    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