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

  • SEARCH
  • Home
  • 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 3952800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:53:53+00:00 2026-05-20T01:53:53+00:00

i have 2 txt fields named stuno and stuname . when i enter student

  • 0

i have 2 txt fields named stuno and stuname . when i enter student no in the txtfield1 it pulls and shows the student name in the txtfield2. so here is what iam doing onload of the document iam putting the focus on txtfield1(stuno).If i dont put the focus it is pulling the Name very fine . IF i have the focus it is not pulling.Onload of the form
i need to have focus on the txtfield1(stuno).Here is the code which i have please correct me if iam doing something wrong.

$(document).ready(function(){
    $("#stuno").focus();
    $("#stuno").change(function(){
            if ( jQuery.trim( $( '#stuno' ).val() ) == '' ) {               
                $('#stuname').val( '' );
                $( '#stuerr' ).text( 'Student Account Not Valid!' ) ;
            }
            else{
                  $.ajaxSetup ({cache: false}); 
                  $.getJSON("student.php",{'stuno' : $("#stuno").attr('value')},
                    function(data){                                         
                      if(data[0].status){                           
                            var labelvalue = data[0].label.split('-');
                            $("#stuname").attr("value",labelvalue[1]);  
                      }else{                          
                          $('#stuname').val( '' );
                          $( '#stuerr' ).text(data[0].label);
                      }
                      if(  $("#stuname").attr("value") ){                               
                          $( '#stuerr' ).text( '' ) ;
                     }
                   });

            }
        });
    });
}
  • 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-20T01:53:54+00:00Added an answer on May 20, 2026 at 1:53 am

    Try using keypress instead of change. Change is fired when you leave focus of the input or when a select box is changed. Keypress is fired whenever a key is pressed or released.

    So instead of:

    $("#stuno").change(function(){
    

    use

    $("#stuno").keypress(function(){
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my text fields defined as follows: <fieldType name=text class=solr.TextField positionIncrementGap=100 omitNorms=false> <analyzer
I Have recordset rc1 that reads values from txt file. The fields are rtn
I have a table with one field as name.The values in this fields are
I have a file (dictionary.txt) with data field entries as follows - ABC This
Within an web form I have a some input fields <div id=search1> <div class=forminput>
I have a SQL Loader Control file, LOAD DATA INFILE 'test.txt' INTO TABLE TEST
I have a pipe delimited file with some NULL date fields. I load this
I have various text fields and sometimes their values have hypens/dashes in them, e.g.
I have to fill in multiple form fields on a web page I got
I have a rather simple SOLR structure, that hold three different fields: id, text

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.