I have the following list with an unordered list with id # sortable1, which I want to achieve - whenever the li element is clicked with <ul id = "sortable2"> the onclick event should occur and alert the id from the li element that was clicked. I have one element also in an unordered list that cannot be clicked with class = "emptyMessage"
I'm stuck and don't know how to act
I still have
<ul id="sortable1" class="connectedSortable ui-sortable">
<li class="ui-state-default" id="1">Name1</li>
<li class="ui-state-default" id="2">Name2</li>
<li class="ui-state-default" id="3">Name3</li>
<li class="ui-state-default" id="4">Name4</li>
<li class="ui-state-default" id="5">Name5</li>
<li style="display: list-item;" class="emptyMessage">No more contacts available</li></ul>
My jquery code
$("#sortable1 li").click(function() {
alert('Clicked list.'+$(this).value);
});
source
share