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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:00:15+00:00 2026-05-31T18:00:15+00:00

i want to use focus function in jquery to return to same area of

  • 0

i want to use focus function in jquery to return to same area of the input after clicking the submit button to change code of captcha,but it didn’t return to area of the input,and return to the top of the page,i looked for the same problem here,and tried all but also didn’t work
is there anyway to do that correctly,or another method to return to same area of input after clicking by jquery,not DOM?

<form action="" method="post">   
    <h4>enter pic code</h4>
    <img src="captcha.php" id="captcha" />
    <br />
    <label><a  href="#" onclick="document.getElementById('captcha').src='captcha.php?'+Math.random();"
id="change-image">change captcha code</a></label>
    <input type="text" name="captcha" id="captcha-form" />
</form>

<script>
    $(document).ready(function(){
        $("#change-image").focus();
    });
</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-05-31T18:00:16+00:00Added an answer on May 31, 2026 at 6:00 pm

    Try: onclick="document.getElementById('captcha').src='captcha.php?'+Math.random(); return false;"

    adding return false; is very important when working with event bindings to prevent default behaviour.

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

Sidebar

Related Questions

I have a page in which i can successfully use the jquery focus function
I want to use jQuery to create around a text input, a green border
I want use JQuery mobile for the front-end of my mobile application, but I
I want use jQuery in my project. I know the javascript_include_tag calls the jQuery
I have a problem with jQuery Validator. I want to use required property on
I can use jQuery to bind a function to a keyup event within the
I use some jQuery to highlight form fields. But not the input field itself
I want to use an image of a calendar to show/hide the jquery datepicker.
Can I pass the button ID dynamically? $('#Button1').focus(function () { if (document.getElementById('HiddenVal').value != null
I want to use jquery live() to automatically select the text in a 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.