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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:04:55+00:00 2026-06-17T16:04:55+00:00

I want JavaScript to translate text in a textarea into binary code. For example,

  • 0

I want JavaScript to translate text in a textarea into binary code.

For example, if a user types in "TEST" into the textarea, the value "01010100 01000101 01010011 01010100" should be returned.

I would like to avoid using a switch statement to assign each character a binary code value (e.g. case "T": return "01010100) or any other similar technique.

Here’s a JSFiddle to show what I mean. Is this possible in native JavaScript?

  • 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-17T16:04:56+00:00Added an answer on June 17, 2026 at 4:04 pm

    What you should do is convert every char using charCodeAt function to get the Ascii Code in decimal. Then you can convert it to Binary value using toString(2):

    function convert() {
      var output = document.getElementById("ti2");
      var input = document.getElementById("ti1").value;
      output.value = "";
      for (var i = 0; i < input.length; i++) {
          output.value += input[i].charCodeAt(0).toString(2) + " ";
      }
    }
    <input id="ti1" value ="TEST"/>
    <input id="ti2"/>
    <button onClick="convert();">Convert!</button>

    And here’s a fiddle: http://jsfiddle.net/fA24Y/1/

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

Sidebar

Related Questions

I want the javascript code to be someFunction(42, function onSuccess() {}, function onFailure() {})
Want to run javascript function from parent window in child window Example I have
I want change following javascript code to jquery code, How is it? With done
I use Sublime Text and want JavaScript files to use three spaces for indentaiton.
Here is my code: <script language=javascript type=text/javascript> $(document).ready(function(){ $('.tree div').click(function(){ var id = $(this).attr('id');
I've got the regexes working in Javascript, now I want to translate these to
Basically I need to translate the following piece of JavaScript into CoffeeScript. location.href =
I have a javascript file, and I want to translate it in C, I
I am trying to run the following code, to assign user selected text in
I want to use Bing Translator API to automatically translate some text in a

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.