0

Is there a way using angular or just javascript to get the user input text not using HTML input boxes? For example when a user clicks on a paragraph he will be able to change its text without a text area popping so he could input. I tried focusing on angular ngHide element( a input HTML) but with no success. It only focused on the element when its showing.

3
  • 1
    It is possible, but most likely is not a good idea. What is the problem with input fields? Commented Aug 15, 2016 at 7:16
  • Do the same with input field only and customize that using css and make a feel of normal paragraph instead of input Commented Aug 15, 2016 at 7:16
  • @SyamPillai auto height will not work on input not a good idea Commented Aug 15, 2016 at 8:11

3 Answers 3

2

Try contenteditable introduced in HTML 5.

Try Fiddle.

<p contenteditable="true" onfocus="alert(this.textContent)" onblur="alert(this.textContent)">
   Enter Name
</p>
Sign up to request clarification or add additional context in comments.

Comments

0

But there is. contenteditable is an HTML attribute that makes divs and cells editable. you can make a directive in angularjs to use that, but beware of the caveats that it introduces.

Comments

0

Take a look at x-editable. It will suit your needs, i think.

Comments

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.