SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onClick in <select>

    Hi:

    I know there is no onClick event in <select>. I was wondering if there is a way to do that.

    What I have right now, is a text box. When somebody enters some text in this text box, a <SELECT> box is fetched with AJAX (with size=20). When user presses DOWN key in the text box (keyCode=40), it selects the first element of thist <select> box.

    It works up until the step above. But, when it selects the first element, <SELECT> box disappears ( that's how it works) because onChange event fires for that <SELECT> box.


    What I want is that this <SELECT> box does NOT DISappear UNTIL user presses ENTER (working) OR user CLICKS in this select box.

    Is that possible? Is yes, then how?

    Thanks
    ---------------------------
    Errors = Improved Programming.
    My Site

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why dont you use autocomplete fields.

    If you dont know what autocomplete is, try googling it out. I think that might solve your problem.

  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I saw many examples on autocomplete fields, but they all take data from a javascript file.

    I am not much experienced in Javascript that I can change that to fit what I want.

    What I do is, I call a page with AJAX which can return the data in any format I need. So, if anyone can help me to modify one of these in a way that these scripts take data from a server-side page then that'd mostly helpful.

    Thanks
    ---------------------------
    Errors = Improved Programming.
    My Site

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I think you've got confused with the lack of an onclick event for the OPTION element in IE (there is one for good browsers). There is an onclick event for SELECT and it works in IE and other browsers.


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
  •