Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9093595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:08:33+00:00 2026-06-16T23:08:33+00:00

In this sample code http://plnkr.co/l6kv7x I want to move the focus into text input

  • 0

In this sample code http://plnkr.co/l6kv7x I want to move the focus into text input and select the content when the user clicks the edit button but I didn’t figure it out how to do it in AngularJS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:08:34+00:00Added an answer on June 16, 2026 at 11:08 pm

    The question is very similar to AngularJS – Focusing an input element when a checkbox is clicked, so here is a very similar solution: a focus directive, that takes editing as an attribute:

    app.directive('focus', function() {
        return function(scope, element, attrs) {
            scope.$watch(attrs.focus, function(newValue) {
                newValue && element[0].focus()
            })
        }
    });
    

    As @Josh already pointed out, we can use the native DOM focus() method, by accessing the raw DOM element using element[0] — element itself is a wrapped jqLite (or jQuery if loaded) element.

    The HTML:

    <input ng-show="editing" type="text" ng-model="text" value="{{text}}"
      focus="editing">
    

    Fiddle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is wrong with this sample code? o_O <html> <head> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script> <script
A friend show me this sample code to implement HTTP POST in C# and
I have downloaded the sample code from this site for FTP Client http://www.lysesoft.com/products/andftp/index.html But
I currently have this piece of code: NSString *strURL = [NSString stringWithFormat:@http://www.sample.com /phpFile.php?firstname=%@,txtfirstName.text]; NSString
i execute this sample code in android3.0 http://developer.android.com/resources/samples/BluetoothChat/res/index.html Bluetooth Chat <!-- BluetoothChat --> <string
This is my sample code. The select function is not working. What I'm doing
I'm using this sample code to view a PDF in my iPhone app: http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281-Intro-DontLinkElementID_2
I used this sample code in a similar clock application: http://about-android.blogspot.in/2010/04/create-apps-to-show-digital-time-in_19.html It works fine,
I find this link everywhere for SQLite sample code ( http://developer.apple.com/library/ios/#samplecode/SQLiteBooks/index.html ) but either
I'm running this sample code located here: http://monoclestudios.com/cocos2d_whitepaper.html using cocos 2d-iphone 0.7.2, and the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.