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 6354163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:31:59+00:00 2026-05-24T22:31:59+00:00

I have the following script in my html page: <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js type=text/javascript></script> <script type=text/javascript>

  • 0

I have the following script in my html page:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var k_InitialTextBoxValue = "Please enter a cd name";

        function requestSuggestion(partialCdName) {
            $.ajax({
                type: "GET",
                url: "Web1",
                data: "suggest=" + partialCdName,
                success: function (msg) {
                    alert(msg);
                }
            });
        }

        $("#textCdName").val(k_InitialTextBoxValue);

        $("#textCdName").focus(function () {
            alert($(this).val());
            /*if ($(this).val() == k_InitialTextBoxValue) {
                $(this).val() = "";
            }*/
        });


        $("#textCdName").keyup(function () {
            requestSuggestion($("#textCdName").val());
        });
    });
</script>

Everytime I focus the #textCdName text box element once, I got an infinite number of alert windows instead of one. This occurs in Chrome (v13), in IE it works fine.

Did this occure to anyone? how do I solve this issue?

  • 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-05-24T22:32:00+00:00Added an answer on May 24, 2026 at 10:32 pm

    This makes sense because when you throw an alert, the textbox loses focus (focus is now on the alert dialog).

    When you dismist the alert box, the textbox gets focus once more, resulting in a new focus event firing and thus a new alert.

    Instead of using an alert to debug your code, consider using console.log which adds the message to the console (you’ll need a console viewer to see the messages, I’m not sure if there’s one built in to Chrome).

    console.log($(this).val());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am referencing JavaScript as follows on an HTML page: <script type=text/javascript src=http://code.jquery.com/jquery-1.6.1.min.js></script> <script
I have the following code on an html page: <script type=text/javascript> <!-- window.location.replace(http://www.example.com/); -->
I have the following HTML page: sample_page.html: <h1>sample html page</h1> <script type=text/javascript src=sample_page.js/> The
I have the following HTML structure: $('#subgroup a').nextUntil('h3').wrapAll('<div></div>'); <script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js></script> <div id=subgroup> <h3>Group name
I have the following file file: <html> <head> <title></title> <script type=text/javascript src=/Prototype.js></script> <script type=text/javascript>
I have the following script at the end of my page: <script type=text/javascript> jQuery.noConflict();
I have the following, very simple html page: <html> <head> <script type="text/javascript"> function alertSelection()
I have the following script element in my web page: <script src=default.js type=text/javascript></script> Using
I have the following HTML containing a drop down list (single selection) <script type="text/javascript">
I currently have the following JavaScript/jQuery script that gets an external html page using

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.