SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can't change textarea to input, otherwise the virtual keyboard is not working

    Hi guys, i've been trying to customizing this virtual keyboard but have no clue what is wrong.

    If i change
    <textarea id="write" type="password" rows="1" cols="30"></textarea>
    to
    <input id="write" type="password"/> the virtual keyboard isn't working.

    Could anyone please help me how to solve this? Thanks in advanced.

    Please check this out
    http://jsfiddle.net/rhXx8/2/

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    Hi there,

    This is the line responsible for updating the output:

    Code JavaScript:
    $write.html($write.html() + character);

    When $write references a <textarea> element, everything works as expected, however when you change the <textarea> element to in <input> element, the script fails, as an <input> element doesn't have a .html() method.

    Change the above line to this and things will work as expected:

    Code JavaScript:
    $write.val($write.val() + character);

    Hope that helps.

  3. #3
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Pullo, thanks for your help. It works.

    As you said that "an <input> element doesn't have a .html() method", do you know where can i find the best reference of this?
    Thanks again

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    Hi there,

    Quote Originally Posted by botpro7 View Post
    As you said that "an <input> element doesn't have a .html() method", do you know where can i find the best reference of this?
    A good place to look is the jQuery API documentation.

    In this particular case, looking at the docs for .html() might be a good place to start.

  5. #5
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks, might need a longer time to get the whole picture...


Tags for this Thread

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
  •