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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:39:55+00:00 2026-06-05T10:39:55+00:00

I have this right now: <input type=text placeholder=Paste text onPaste=alert(this.value);> This does infact work,

  • 0

I have this right now:

<input type="text" placeholder="Paste text" onPaste="alert(this.value);">

This does infact work, except, it returns a blank alert window. I don’t get any value. Help?

  • 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-05T10:39:57+00:00Added an answer on June 5, 2026 at 10:39 am

    The onpaste event fires before the input‘s value is changed. You need something such as a setTimeout:

    <input type="text" placeholder="Paste text" onPaste="var e=this; setTimeout(function(){alert(e.value);}, 4);">​
    

    I’m storing a reference to this inside a global var as this is not accessible inside the scope of a timeout function which is attached to the window object.

    I’m using 4 miliseconds as the Timeout as it’s the minimum valid Interval/Timeout in the HTML5 specification. Edit: As noted in the comments, you may also use 0 miliseconds as timeOut which is automatically recalculated to 4. jsPerf tests.

    Fiddle

    You may as well use a function call inside your onpaste event passing this as a parameter to prevent your HTML mixing with JS too much. 🙂

    And here’s a function easier to read and which you can use in multiple inputs:

    function pasted(element) {
        setTimeout(function(){
            alert(element.value);
        }, 0); //or 4
    }​
    

    Which can be called with simply onPaste="pasted(this)" for any input.

    Fiddle

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

Sidebar

Related Questions

I have this code right now to get the row value from jquery grid..
Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that
hey, well I have this form <form method=POST action=''> <input type=hidden name=op value=download1> <input
I have this jQuery code: <script type=text/javascript > $(function() { $('#add_comment').bind('submit',function() //$(input[type=submit]).click(function() { var
I have this right now: <%= f.select :credit, (0..500) %> This will result in
Right now I have this layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent
Right now I have this jQuery('.widget-prop').keyup(function() { var prop = jQuery(this).attr('id'); var val =
Right now I have this SQL query which is valid but always times out:
Right now, I have this code where $obj_arr maybe contain array and an object.
Here is the thing. Right now I have this e-commerce web site where people

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.