0

I can call the focus() method on an input element on my page and it will bring it into view however I can't appear to actually click into the field?

The input is as follows

<input alt="ACCEPT_TEXT"
       title="ACCEPT_TEXT"
       placeholder="I Understand"
       ng-model="leafNode.transMap[translationLanguage].translation"
       id="leafNode_82"
       class="ng-pristine ng-valid ng-not-empty ng-touched">
$($('input[alt^="ACCEPT_TEXT"]')[0]).focus(); // works

$($('input[alt^="ACCEPT_TEXT"]')[0]).click(); // has no effect

When clicked with the mouse the cursor goes into the input and it goes yellow but right now it just focus and doesn't insert the cursor.

Desired Result

This has me a little blocked at the minute so any help greatly appreciated.

Thanks Mark.

4
  • Are these inputs for text? If so you're missing type="text" in your <input>s Commented May 2, 2016 at 0:28
  • thanks Vtange I introduced the text and yet to no avail. Focuses but no click Commented May 2, 2016 at 5:46
  • any reason you're not using ng-focus and ng-click? It might be a problem between Jquery and Angular -> stackoverflow.com/questions/28958004/… Commented May 2, 2016 at 6:35
  • As I understand it, ng-focus and ng-click are used to bind the reaction after the element has been focussed upon or clicked on. I need to simulate the actual click itself to place the cursor into the input. Commented May 2, 2016 at 11:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.