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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:21:28+00:00 2026-06-18T08:21:28+00:00

On jQuery keyup on two IDs a function is executed. $(‘#supplier_name’).keyup(function(){ clearTimeout(typingTimer); if ($(‘#supplier_name’).val)

  • 0

On jQuery keyup on two IDs a function is executed.

$('#supplier_name').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#supplier_name').val) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
    $.cookie("inputFocus", "#supplier_name"); 
});

After this the form is submitted. I want to do jQuery .focus on the ID which led the keyup function to execute.

So if I entered text into #supplier_name after form submit I want the focus to be on that. Vice versa with #aircraft_type.

EDIT: I am trying to do this via cookies however it doesn’t seem to be working.

How do I do this with the following jQuery code:

<script>
$(document).ready(function() {
    $("#state").change(function () {
    this.form.submit();
})
$.cookie("inputFocus").focus();
$("#supplier_name").val($("#supplier_name").val());
$("#aircraft_type").val($("#aircraft_type").val());
var typingTimer;                
var doneTypingInterval = 800;  

$('#supplier_name').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#supplier_name').val) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
    $.cookie("inputFocus", "#supplier_name"); 
});

$('#aircraft_type').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#aircraft_type').val) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
    $.cookie("inputFocus", "#aircraft_type"); });

function doneTyping () {
    $("form").submit();
}

});
</script>
  • 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-18T08:21:30+00:00Added an answer on June 18, 2026 at 8:21 am

    The solution to the above problem was to create an object to use focus() and to add the jQquery cookie plug-in.

    The change is below:
    “$.cookie(“inputFocus”).focus();” to “$($.cookie(“inputFocus”)).focus()”

    Added the below code to the page:
    “”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following javascript (jquery) $(#username).keyup(function () { selected.username = $(#username).val(); var url =
Revised Code jQuery(function($) { $(#filter).keyup(function () { var filter = $(this).val(), count = 0;
I'm using jQuery to try something like this: $('input').keyup(function(e){ var val = $(this).val(); var
I have these two functions: jQuery.fn.enterText = function(e){ if( $(#cursor).val() && e.keyCode != 32
Right now I have this jQuery('.widget-prop').keyup(function() { var prop = jQuery(this).attr('id'); var val =
JavaScript (JQuery) $('input').keyup(function(e) { var code = e.keyCode ? e.keyCode : e.which; switch(code) {
I have the follwing jQuery: $(#textArea).keyup(function(){ var textAreaValue = $(textArea); if(!textArea.value.indexOf(some string)){ textArea.value =
I have a function that detects all input value changes with keyup: Jquery: //
I need to use jQuery's keyup function to take the value from input html
How to know if .keyup() is a character key (jQuery) $(input).keyup(function() { if (key

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.