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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:39:48+00:00 2026-05-25T23:39:48+00:00

This method detects ctrl + v event but I couldnt find how to get

  • 0

This method detects ctrl + v event but I couldnt find how to get the value of it ?

Thanks in advance,

$(".numeric").keydown(function (event) {
    if (event.shiftKey) {
        event.preventDefault();
    }

    switch (event.keyCode) {

        case 86:
            if (event.ctrlKey) { // detects ctrl + v
                var value = $(this).val();
                alert(value); // returns ""
            }
            break;

    }
  • 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-25T23:39:49+00:00Added an answer on May 25, 2026 at 11:39 pm

    All you have to do it hook into the paste event, let it finish by breaking the callstack and then read the value.

    It might seem ugly but it is very crossbrowser friendly and saves you creating a lot of crappy code just to read the actual clipboard.

    $(".numeric").bind('paste', function (event) {
    
      var $this = $(this); //save reference to element for use laster
    
    
      setTimeout(function(){ //break the callstack to let the event finish
    
        alert($this.val()); //read the value of the input field   
    
      },0); 
    });
    

    See it in action here: http://jsfiddle.net/Yqrtb/2/

    Update:

    Since i just recently had to do something similar, i thought i’d share my final implementation, it goes like this:

    $('textarea').on('paste',function(e) {
        //store references for lateer use
        var domTextarea = this,
            txt = domTextarea.value,
            startPos = domTextarea.selectionStart,
            endPos = domTextarea.selectionEnd,
            scrollTop = domTextarea.scrollTop;
    
        //clear textarea temporarily (user wont notice)
        domTextarea.value = '';
    
        setTimeout(function () {
            //get pasted value
            var pastedValue = domTextarea.value;
    
            //do work on pastedValue here, if you need to change/validate it before applying the paste
    
            //recreate textarea as it would be if we hadn't interupted the paste operation
            domTextarea.value = txt.substring(0, startPos) + pastedValue + txt.substring(endPos, txt.length);
            domTextarea.focus();
            domTextarea.selectionStart = domTextarea.selectionEnd = startPos + pastedValue.length;
            domTextarea.scrollTop = scrollTop;
    
            //do work on pastedValue here if you simply need to parse its ccontents without modifying it
    
    
        }, 0);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this method I return a value of the type Double, but there is
This method is working totally right in matlab. but, when I compiled it in
I have got this circle detection working but only detects 1 circle. How would
I have a method which detects the onChange event on a select box. When
This method works as expected - it creates a JTree with a root node
This method that draws my tiles seems to be quite slow, Im not sure
With this method declaration (no overloads): void Method(double d) { // do something with
Take this method /** * @return List of group IDs the person belongs to
Can this method work? public String sayHello(){ return Hello.jsp?name= + laala; } I am
Having this method: public Boolean isCorrect() { return correct; } I can't write: @XmlType(propOrder

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.