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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:21:23+00:00 2026-06-04T00:21:23+00:00

I’m newbie in terms of Javascript. Here’s my problem: I wish to capture credit

  • 0

I’m newbie in terms of Javascript. Here’s my problem:

I wish to capture credit card information from a card reader and then process it. So far, I’ve been able to capture dummy credit card data in an HTML textbox field – its no rocket science actually, ‘cos the card reader input is just a set of keyboard events when a card is swiped through a card reader. The issue is that it works only when there is a cursor focus on a text field. If i turn the textfield into a read only box, it doesn’t work – which is my exact requirement. I should be able to mask the input, show a couple of *s and I should be able to make the field non-editable. I’m hoping this could be done using a transparent div placed on the textbox – but I have no idea how that can be achieved.

I’m open to other ideas too.

  • 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-04T00:21:25+00:00Added an answer on June 4, 2026 at 12:21 am

    You can use javascript to set a disabled text field’s value, and to get keystroke event data through document.onkeydown = function(e) { ... }. No need for hidden divs.

    I assume you have other fields on your page, which will make it difficult to know when to capture the card reader data. Are you fortunate enough that your credit card reader sends some unique first character(s) so you know the keyboard events are coming from the reader and not user keystrokes? If so, then you can listen for those particular key strokes so you don’t have to worry about setting focus. Otherwise maybe consider a button like “Read Credit Card” that has an on("click") function set to read the next xx digits.

    Here’s some debugging code you can use to see if your reader sends any unique characters that you can listen for:

    document.onkeydown = function(d) {
        console.log( d.which ? d.which : window.event.keyCode);
    };
    

    It’s conceivable that there’s some other unique event information when the reader is used. Maybe check the device’s manual.

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

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I used javascript for loading a picture on my website depending on which small
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:

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.