Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery accordion - set input focus for active accordion?
    primarykey
    data
    text
    <p>**Nevermind. I figured it out. **</p> <p>I did it like this:</p> <pre><code>$("#accordion").accordion({ header:'h3', active: '#section1', autoheight: false, clearstyle: true, }).bind("change.ui-accordion", function(event,ui) { $("#text1").focus(); }); </code></pre> <hr> <p>I've got an accordion all set up, and each div has a form within it. I'm just trying to figure out how to set the focus on an input field depending on which one is open...</p> <pre><code>/* accordion */ $("#accordion").accordion({ header:'h3', active: '#section1', autoheight: false, clearstyle: true }); </code></pre> <p>Basically, I want to set the cursor in the first input field for whichever section is open. The actual forms are much bigger, so I condensed it enormously...</p> <pre><code> &lt;div id="accordion"&gt; &lt;h3 id="section1"&gt;&lt;a href="#"&gt;Section 1/a&gt;&lt;/h3&gt; &lt;div&gt; &lt;form id="form1" action="form.php" method="post"&gt; &lt;fieldset class="inside"&gt; &lt;input type="text" name="text1" id="text1" size="50" value="Default text" /&gt; &lt;input class="open" type="button" value="Submit" name="submit1" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt;&lt;!--/div--&gt; &lt;h3 id="section2"&gt;&lt;a href="#"&gt;Section 2&lt;/a&gt;&lt;/h3&gt; &lt;div&gt; &lt;form id="form2" action="form.php" method="post"&gt; &lt;fieldset class="inside"&gt; &lt;input type="text" name="text2" id="text2" size="50" value="Submit" /&gt; &lt;input class="open" type="button" value="Submit" name="submit2" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt;&lt;!--/div--&gt; &lt;h3 id="section3"&gt;&lt;a href="#"&gt;Section 3&lt;/a&gt;&lt;/h3&gt; &lt;div&gt; &lt;form id="form3" action="form.php" method="post"&gt; &lt;fieldset class="inside"&gt; &lt;input type="text" name="text3" id="text3" size="50" value="Submit" /&gt; &lt;input class="open" type="button" value="Submit" name="submit3" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt;&lt;!--/div--&gt; </code></pre>
    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