jquery .click function not getting triggered

Posted by aakashbhowmick on Stack Overflow See other posts from Stack Overflow or by aakashbhowmick
Published on 2010-12-31T16:10:33Z Indexed on 2010/12/31 16:54 UTC
Read the original article Hit count: 187

I have the following HTML and Javascript code. I am trying to make a search suggestion system. The list-items in the unordered-list 'search_suggest' are retrieved dynamically using ajax as the user types in the input box 'site_search' and inserted.

<form name="search_site_form" method="get" action="search.php">
        <input id="site_search" name="q" class="search_input input" autocomplete="off" value="Search the site" type="text"/>

    <ul id="search_suggest">
    </ul>
    <input value=" " type="submit" class="search_submit"/>
    <script type="text/javascript">
    <!--
        $("ul#search_suggest>li").click(function(){ 
        alert('123');
    });
    //-->
    </script>
</form>

Clicking on the list items in search_suggest however is not triggering the click function. Any idea why?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery