SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Display Input Field Information Simultaneously in <P> tag?

    What I'm trying to do is display whatever is typed within an input field simultaneously inside of a <p> tag.

    For Example:

    If the name Mark is typed into the input field, i would want "Mark" displayed somewhere else on the page inside of a <p> tag and the letters are typed in the input field it displays each etter as its being typed.. is this possible?

  2. #2
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    I know of a jQuery plugin that does this: http://docs.jquery.com/Tutorials:Rea...omment_Preview
    Maleika E. A. | Rockatee | Twitter | Dribbble



  3. #3
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kohoutek View Post
    I know of a jQuery plugin that does this: http://docs.jquery.com/Tutorials:Rea...omment_Preview
    just tested it out it seems to be exactly what im looking for thank you!

  4. #4
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    double post

  5. #5
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by enwise View Post
    What I'm trying to do is display whatever is typed within an input field simultaneously inside of a <p> tag.
    You can do that with about 3-4 lines max of plain javascript code.

    You could put an onkeyup event handler on the <input> which takes the current value of the <nput> and assigns it to the innerHTML property of a <p>.

    If you use the now frowned inline scripting, your can do it with a 1 line onkeyup in the <input>. No need for jQuery at all.

  6. #6
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why is that inline scripting frowned on?

  7. #7
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    inline scripting still has its place but it's generally frowned upon nowadays as part of the higher emphasis on keeping content, styling and functionality as separate as possible.

  8. #8
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm going to be using the input field for names, for something as simple as that would you say the jquery method or the onkeyup method would be better to use?

  9. #9
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use whichever you are more comfortable with.

    But who knows how much extra code jQuery runs in the background to perform the same task. I suspect it'll be a lot more lines of code than 3-4 max it would take without jQuery.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •