More about putting a TE in a JQuery tabs widget tab
I have been pulling my hair out over this one. I can setup a JQuery Tabs widget and I can put a JQuery TE into each tab. I can also put a plain old boring TEXTAREA into each tab. Problem is, when I click a tab, I want it to give focus to the text editor instance in the tab. I have tried a variety of ways ot make this work with no luck.
The code I have been playing with is pasted below. You can see in the javascript function that I have tried several different ways to approach it, all with no luck. This must be doable, maybe someone here knows the trick?
Thanks very much...
- <!DOCTYPE html>
-
- <html>
- <head>
-
- <meta charset="UTF-8" />
-
- <link href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
- <script src="http://code.jquery.com/jquery-1.11.3.js"></script>
- <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
-
- <!-- JQuery TE (HTML editor) -->
- <link href="./jquery-te-1.4.0.css" rel="stylesheet" />
- <script src="./jquery-te-1.4.0.min.js"></script>
-
- <script>
- $(function() {
- $(".editor").jqte();
- })
-
- $(function()
- {
- $("#messages").tabs(
- {
- activate: function (event, ui)
- {
- ui.newpanel.setActive();
- ui.newpanel.focus();
-
- //$("#tab_a").focus();
- //$("#tab_a").setActive();
-
- //alert( "You clicked a tab!" );
-
- //var temp = document.getElementById("tab_a");
- //temp.focus();
- //temp.setActive();
- }
- })
- })
-
-
- </script>
- </head>
-
- <body>
-
- <FORM>
- <table id="table_text">
- <TR>
- <TD>
-
- <div id="messages">
- <ul>
- <li><a href="#tab_a">Tab A</a></li>
- <li><a href="#tab_b">Tab B</a></li>
- <li><a href="#tab_c">Tab C</a></li>
- </ul>
-
- <div id="tab_a">
- <textarea id="tab_a" class="editor" rows="20" cols="72"> </textarea>
- </div>
-
- <div id="tab_b">
- <textarea id="tab_b" class="editor" rows="20" cols="72"> </textarea>
- </div>
-
- <div id="tab_c">
- <textarea id="tab_c" class="editor" rows="20" cols="72"> </textarea>
- </div>
-
- </div>
-
- </TD>
- </TR>
- </table>
- </FORM>
- </body>
-
- </html>