PDA

View Full Version : Cursor Position in DateField



Kaiser_Wilhelm
19 Mar 2012, 12:12 PM
Hello,
I am trying to find the current cursor position in a datefield. I have a function that gets hit onkeyup and I tried getting the element by ID then getting the selectionStart but that doesnt exist for the div element. Has anyone had any luck getting the cursor position in a datefield object?

mitchellsimoens
19 Mar 2012, 12:20 PM
More of a JavaScript question

http://stackoverflow.com/questions/4928586/get-caret-position-in-html-input

Kaiser_Wilhelm
19 Mar 2012, 1:06 PM
This seems to not work with the datefield object thats why I posted this here. I create the datefield and on "keyup" I enter a function that uses document.getElementById ('datefield') and then looks for selectionStart but it doesnt exist.

Kaiser_Wilhelm
20 Mar 2012, 7:43 AM
I realized this is because the element I am getting by ID is the DIV itself. You need to go into the child elements to find the input tag.