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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:05:49+00:00 2026-05-16T21:05:49+00:00

$(#inputField).focus() when the cursor focuses on the texbox i want to do one space,

  • 0
$("#inputField").focus()

when the cursor focuses on the texbox i want to do one space, so it moves to the right a little further!! if you know what i mean thanks

function insertParamIntoField(anchor, param, field) {
       var query = anchor.search.substring(1, anchor.search.length).split('&');

       for(var i = 0, kv; i < query.length; i++) {
          kv = query[i].split('=', 2);
          if (kv[0] == param) {
             field.value = kv[1];
             return;
          }
       }
    }


$(function () {
    $("a.reply").click(function (e) {
       console.log("clicked");
       insertParamIntoField(this, "replyto", $("#inputField")[0]);

     $("#inputField").focus()







       e.preventDefault();
       return false; // prevent default action
    });
});
  • 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-16T21:05:50+00:00Added an answer on May 16, 2026 at 9:05 pm

    Attach an event handler for the focus event that sets a space if the input is empty:

    $("#inputField").focus(function() {
        if($(this).val() == "") {
            $(this).val(' ');
        }
    });
    

    Or do you want to add a space every time the box is focused? Then the body of the callback function just needs to be:

    $(this).val($(this).val() + ' ');
    

    Update:

    Ah I see, well the easiest way would be (forget about attaching an event handler for focus):

    $("a.reply").click(function (e) {
           console.log("clicked");
           insertParamIntoField(this, "replyto", $("#inputField")[0]);
    
           $("#inputField").val($("#inputField").val() + ' ');
    
           //...
    }
    

    But you should make sure that clicking the link twice does not result in adding the name twice!

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

Sidebar

Related Questions

You know that sexy glow that surrounds an input field whenever it has focus?
Scenario: I want to enter an address (Sweden, Stockholm) into an inputfield and get
How can the cursor be focus on a specific input box on page load?
I want to make a form in which I want to automatically give focus
I have a HTC Desire phone and want to show set focus to input
I want to have a JTextField (or another text-like input which supports focus and
I am focusing on an input field with jQuery: $(input:text).focus(); There is already some
I am trying to validate an input field when it loses focus and re-focus
The following code words if run in the console itself: var $inputbox = $('input#inputfield');
I have one input field and one division with span children <input type=text id=input

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.