1

I've used one of the many angular directive based solutions for this, it would be a hassle to type out all of it. In fact, the updated answer given by Shimon on this question is exactly what I have done, and it indeed autofocuses as desired.

However, I've got some placeholder text that I want to be in front of the cursor. So ideally, the behaviour would be like this

"placeholder"[cursor]

but it is instead like this

[cursor]"placeholder"

I feel like I'm so close to what I want to do. Any ideas?

EDIT : my input text box is a bit different. The placeholder is an angular scope variable.

<input type="text" ng-model= "symbol" placeholder= "{{symbol}}" ....>
Community
  • 1
  • 1
Zack
  • 13,454
  • 24
  • 75
  • 113
  • May I ask why it actually matters? Placeholder disappears as soon as a user starts to type. I'm assuming you're using something like this: ``. – PM 77-1 Sep 04 '14 at 18:57
  • Nope. place holder is an angular scope variable... think like google. You know how you start typing on the main screen and then it takes you to your search results page with the cursor already after what you had typed in on the initial screen? I want to do something like that. – Zack Sep 04 '14 at 18:59
  • And to add to that, the placeholder isn't disappearing. – Zack Sep 04 '14 at 19:01
  • 1
    Look at this [`jQuery` solution](http://www.sitepoint.com/jqueryhtml5-input-focus-cursor-positions/). Will it work for you? If so, you can create a custom `input` directive that will use such logic. – PM 77-1 Sep 04 '14 at 19:09
  • Taking a different approach for now, but it was helpful to look at, thank you. – Zack Sep 04 '14 at 21:33

0 Answers0