SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    66 Post(s)
    Tagged
    2 Thread(s)

    Get value from input

    I'm creating a quick validation through ajax for new usernames. I had the whole thing working correctly but I've decided to change it from checking onkeyup to clicking an href link.

    So I need a way to get the data from a <input> to href="checkUser(this.Value)" to send to my script.

  2. #2
    SitePoint Evangelist TommiChi's Avatar
    Join Date
    Oct 2008
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe I'm totally missing something here, but why don't you put an event listener on the link that will fire the exact same function that your keyup event is firing. You can pass the target field as an argument of the function, so that your function can be reused without having to hard-code all the fields you need in it.

  3. #3
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    66 Post(s)
    Tagged
    2 Thread(s)
    Doh. I was just over thinking this and was looking at code too long.

  4. #4
    SitePoint Evangelist TommiChi's Avatar
    Join Date
    Oct 2008
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I read the post that you deleted. That is why I mentioned "You can pass the target field as an argument of the function" instead of using "this", but I assume you've figured that out now.

  5. #5
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    66 Post(s)
    Tagged
    2 Thread(s)
    Yes that's what I did. Overthinking it I suppose.


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
  •