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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:03:05+00:00 2026-06-02T00:03:05+00:00

I have a span with a text in it that suppose to change constantly

  • 0

I have a span with a text in it that suppose to change constantly after I press something in my textbox.

<input type="text" class="response" onkeypress="return ChangeSpan()" id="how_many" name="how_many" placeholder="Enter how many..." />

and my jQuery:

<script type="text/javascript">
function ChangeSpan() {
    var text = $("#how_many").val();
    $('#changeText').text(text);
}
</script>

it’s working perfectly fine , but when I press let’s say "dfg" , its only present "df" on the span. and only when I add the next charecter, it adds the "g".

I want it to respond also to the last character, how do I do that ?

  • 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-02T00:03:07+00:00Added an answer on June 2, 2026 at 12:03 am

    You probably want to use keyup.

    You use jQuery and add the events inline? That is bad practice. Attach events using on.

    $("#how_many").on("keyup", function(){ $('#changeText').text( this.value ); });
    

    Difference between keyup, keydown, and keypress explained on quirksmode.

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

Sidebar

Related Questions

var text = $(this).text(); alert(text); Afterdata = "<div><span><input type=text class=inputtext value="+text+">"+ "</span>" + "<span
I did a click event that transforms my <span>text</span> into <input type="button" id="buttonclick"> and
Suppose I have something like this: <span class=filesize>File<a href=http://example.com/image.jpg target=_blank>image.jpg</a>-(1.61 MB, 1000x1542, <span title=what
Suppose I have the following HTML element: <span id='kuku' class='lala bubu' value='xyz'>some text</span> I
Possible Duplicate: Select inner text (jQuery) I have a span: <span class=test> target_string </span>
Currently I have a SQL server column of type nvarchar(max) which has text that
Suppose i have the following html: <button class=inforTextButton idmyButton> <span class=leftSlice></span> <span class=centerSlice>Approved</span> <span
Suppose I have this markup: <div id=#titles> <p>Intro text <span>text text</span> text text</p> <ul>
I have a span that contains text that I would like to use. But
I have a <span> of text that isn't defined by height. The text inside

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.