Can't get jquery click() to work in php file

Can't get jquery click() to work in php file

Hi, trying to integrate HTML in PHP file. When I focus on the text displayed in the list the css works. ie: shows in red. However the $("li.disp").click(function () { ... doesn't do anything.

Any help welcomed.

R

  1. <?php

    set_include_path( '../../include' );
    error_reporting (E_ALL ^ E_NOTICE);

    $str=<<<LABEL

    <style>
    .hov:hover {
        color: red;
        font-weight: bold;
        }
       
    li    {
        list-style-type:none;
        }   
    </style>

    <script src="../jquery/jquery-2.1.4.js"></script>

    <script type="text/javascript">

    $("li.disp").click(function () {
       
        consolelog("testing");
        alert($("li,disp").text());

    });

    </script>

    LABEL;

    chdir('/home/rick/Desktop');
    echo $str;
    $path=getcwd();
    $items=scandir($path);

    echo "<p>Contents of $path</p>";
    echo '<ul>';

    foreach($items as $item) {
        if(is_file($item) || $item=="." || $item=="..") {
            continue;
        }
        echo "<li class='disp hov' >$item</>";
    }
    echo '</ul>';


    ?>