Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your best bet would be to add functionality to the existing <code>&lt;input type="text"&gt;</code> using javascript. </p> <p>I don't know how you would create your own textbox as browsers just interpret html which only contain the predefined elements in the HTML specification (apart from certain exceptions such as ActiveX).</p> <p>As a solution regarding to what you want you can capture every keypress using the onKeyUp event of your document. You can catch every keypress and display them to your liking.</p> <p>small example:</p> <pre><code>&lt;script type="text/javascript"&gt; document.onkeyup = KeyCheck; function KeyCheck() { var keyID = event.keyCode; var keypressed; switch(keyID) { case 16: keypressed = "Shift"; break; case 17: keypressed = "Ctrl"; break; case 18: keypressed = "Alt"; break; case 19: keypressed = "Pause"; break; case 37: keypressed = "Arrow Left"; break; case 38: keypressed = "Arrow Up"; break; case 39: keypressed = "Arrow Right"; break; case 40: keypressed = "Arrow Down"; break; } document.write(keypressed); } &lt;/script&gt; </code></pre> <p>for a list of all the keycodes see <a href="http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx" rel="nofollow noreferrer">here</a>.</p> <p><strong>[Update]</strong><br> I just saw that you are also want to know when someone selects text and luckily for you there are also events that handle this:</p> <p>An <code>&lt;INPUT TYPE = "text"&gt;</code> aswell as a <code>&lt;TEXTAREA&gt;</code> have an <code>.onSelect</code> event which you can capture. Then you can get the selected text using the method you find on this other StackOverflow Question: <a href="https://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript">How to get selected text from textbox control with javascript</a></p> <p>If you are working heavily in javascript I suggest you take a look at <a href="http://jquery.com/" rel="nofollow noreferrer">JQuery</a> (if you haven't already). It will definitely make your life easier.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload