Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8294887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:23:20+00:00 2026-06-08T14:23:20+00:00

This is the script <script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $(‘input[type="text"]’).blur(function() { $(this).removeClass("focus");

  • 0

This is the script

<script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
   <script type="text/javascript">
   $(document).ready(function() {
        $('input[type="text"]').blur(function() {
        
            $(this).removeClass("focus");
            var a = $(this).context.id;

            if (a.indexOf('guest') > 0)
            {
                if ($(this).val()&&$(this).val()!=0)
                    {
                        //$(this).parent().parent().next().show();      
                        var b = $(this).parent().parent().next().children().find("textarea");
                        b.parent().parent().show();
                        b.addClass("focus");
                        b.focus();
                    }
                    
                                    
                else
                    {
                        $(this).parent().parent().next().children().find("textarea").val('');
                        $(this).parent().parent().next().hide();}       
            }
        });
    
    });
</script>

Here is the HTML

<table width="620" border="1">
  <tr>
     <td>&nbsp;</td>
     <td style="width:40%"> Memebers $40 </td>
     <td style="width:40%"> Each guest $45 </td>
  </tr>
  <tr>
     <td><input name="breakfast1" type="checkbox" value="breakfast1" tabindex="0" /></td>
     <td>September 12, 2012</td>
     <td style="width:50%">How many guests
        <input type="text" maxlength="2" size="3" id="1guest" name="1guest" tabindex="1" />
     </td>
  </tr>
  <tr style="display:none">
     <td colspan="2">&nbsp;</td>
     <td>
        <textarea class="guests" style="width:300px;" id="1mguests" name="1mguests"  rows="4" tabindex="2">   </textarea>
        <br /><span></span>
     </td>
  </tr>    </table>    and so on<br/>

What am I trying to accomplish:
When tabbing out of the 1guest text field check if the input field has something and if so, un hide (show) the next tr and set the focus to the textarea in the that tr.

What is the problem:
When one enters number of guests in the 1guest input field and TAB out of it, the hidden tr shows OK, the textarea input in the tr gets the class .focus BUT does not get the foucs. What Can be the issue? Is it because the TAB is applied after the focus and therefore goes to the next input field?
In any event can you propose a solution to what I am trying to accomplish?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:23:24+00:00Added an answer on June 8, 2026 at 2:23 pm

    It may be that the .show() is executing in turn, but finishing after the addClass() and focus()

    Try this:

    b.parent().parent().show(function(){
         b.addClass("focus");
         b.focus();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<script src = https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js></script> <script type=text/javascript> //waits till the document is ready $(document).ready(function() {
In a PHP file: <script type="text/javascript"> function click(input){ img = new Image(); img.src =
I made this bookmarklet: javascript:(function(){var s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);$('#hldIntMain').hide();$('#fadeBackground').hide();return false;})() Formatted code: // Add in jQuery var
<script type="text/javascript"> picture1 = new Image; picture1.src = "picture/loading.jpg"; picture2 = new Image; picture2.src
I've written this HAML: %script{:src => http://www.google.com/jsapi?key=mykey :type => text/javascript} Note the missing comma
The code is like this: var script = document.createElement('script'); //script.type = 'text/javascript'; // do
<div id="myLuckyPost"> </div> <script type="text/javascript"> function showLucky(root){ var feed = root.feed; var entries =
In my HTML-head i have this script included: <script id=mode type=text/javascript src=article.js></script> With a
I have written this scirpt: $(document).ready(function () { $('#tb1 li').hover(function () { var head
This is my code : HTML <div id="fb-root"></div><script>window.fbAsyncInit = function() { FB.init({ appId: '1234',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.