Q:

Passing the text to function on Click

Please see the following code:
function liReplace(txt) {
    $('#srch > a').text(txt);
}

<ul class="dropdown">
    <li id='srch'>
        <a href="#">All Categories</a>
        <ul class="sub_menu">
            <li>
                <a href="#">Gadgets</a>
                <ul>
                    <li onclick='liReplace("DVD")'><a href="#" >DVD</a></li>
                    <li><a href="#">XBOX</a></li>
                    <li><a href="#">Ps2</a></li>
                    <li><a href="#">Cellphone</a></li>
                </ul>
            </li>
            <li>
                <a href="#">Locations</a>
                <ul>
                    <li><a href="#">Indoor</a></li>
                    <li><a href="#">Outdoor</a></li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

I wanted to remove the code onclick='liReplace("DVD")' and change it to jquery.
I could use the class="dropdown" to identify it. How do I code and call the clicking of <li> tags inside that ul "dropdown" and pass the text?
i was thinking like
$("li").click(function () {
    $("li").val(this.text);

});

I know its very wrong, my excuse is that I am still in learning phase. 
---ANSWER
$("ul.dropdown li > a").click(function () {
        var old_text = $(this).text();
        liReplace(old_text);
});

A:

Something like that should work:
$(".dropdown .sub_menu ul li").on("click", function() {
    $("#srch > a").text($(this).text());
});

A:

function liReplace(txt) {
    $('#srch > a').text(txt);
}

$("li a").click(function () {
    var old_text = $(this).text();
    liReplace(old_text);
});

