SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    urgent help -----onchange in autocomplete text input tag is not working ?

    <form action="/js" method="post">
    <input id="text_i" onchange="alert('hai');" size="30" type="text"/>
    <input name="commit" type="submit" value="Click Me!" />
    </form>

    i am using firefox 2.0.0.6
    the above html will open a a text box and button

    step 1: enter into box 'aaa' & press button 'Click Me'
    step 2: enter into box 'aab' & press button 'Click Me'
    step 3: now if you enter 'a' into box then autocomplete drop down will open
    so you can select from that(which r given previously)

    but alert is not open

  2. #2
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using onchange="javascript:alert('hai');"

    And try separating the markup from javascript.

    Oh, and use Firebug (it's a firefox extension) to track down Javascript errors.

  3. #3
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    onchange="javascript:alert('hai');"
    not working

    Firebug not shown any error

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    onchange="javascript:alert('hai');" and onchange="alert('hai');" is the same thing...

    I am not sure that I understand the issue. Do you mean that the onchange is not triggered when you select something in the browsers autocomplete list?

    Does it work in other browsers?

  5. #5
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Pepejeria View Post
    onchange="javascript:alert('hai');" and onchange="alert('hai');" is the same thing...

    I am not sure that I understand the issue. Do you mean that the onchange is not triggered when you select something in the browsers autocomplete list?
    yes ,thats my correct question.

  6. #6
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And this is happening only in Firefox?

  7. #7
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello mokkai, did you found a solution for this?

    i have the same problem.

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The onchange should trigger after the field loses the focus. Whether the change was caused by typing or selection shouldn't matter. If that isn't happening then it could be a bug in the browser however it seems unlikely that a bug like that could go unnoticed for so long.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •