0

I have requirement of client in which I need to display cursor of all input tag with type "text" as horizontal cursor as cursor appears in Command prompt.

enter image description here

I think it may be possible with the help of jQuery.

venkatvb
  • 681
  • 1
  • 9
  • 24
Rushabh Shah
  • 178
  • 1
  • 4
  • 13

2 Answers2

5

You might need to think outside the box on this one.

Try making component that mimics a textbox with a blinking cursor inside of it.

<div id="box"><span id="cursor" class="blink">_</span></div>

And adding some behavior:

setInterval(function blink () {
  $('#cursor').toggleClass('hidden');
}, 600);

$(document.body).on('keypress', function(event) {
   $('#cursor').before(String.fromCharCode(event.keyCode));
});

This isn't a solution, but should give you an idea: http://jsfiddle.net/EDLEB/

lxe
  • 7,051
  • 2
  • 20
  • 32
-1

Honestly, I'm not really sure if this is possible or not. Take a look at this fiddle and let me know. If anyone has feedback or ideas about it, that would be appreciated.

Javascript

var element = document.createElement('input');
var blinker = document.getElementsByTagName('span');
element.value = blinker;

document.getElementsByTagName('input').append(blinker);
  • The OP is asking about the cursor that appears in text fields (a.k.a. caret, "text insertion point, text insertion cursor, that flashing thing that is in text boxes"), not the mouse cursor. – Paul D. Waite Oct 30 '13 at 18:17
  • 1
    Isn't ^ a caret? Oh, I'm guessing he means the flashing underscore? – usernolongerregistered Oct 30 '13 at 18:19
  • It is, but the word is also sometimes used to describe the text insertion point indicator I believe. You'd think we'd have good words for these things. And yup, flashing underscore is the thing. – Paul D. Waite Oct 30 '13 at 18:20
  • 1
    After learning Russian, Spanish and Japanese, I've come to understand that English is the simplest language out there, and that's not a good thing lol. Thank you for explaining the downvote, though :) – usernolongerregistered Oct 30 '13 at 18:21