Having an issue with a listitem, when I click the desired li, it doesnt do anything. I for now, will just get it to alert, so i can see it will do the function after ive established that I can get a response from it.
Jquery
$('.propid').click(function(){
alert($(this).find().attr('id'));
});
HTML
<div>
<form class='cform'>
<div>
Type in Property:
<br />
<input class="ui-corner-all" type="text" size="30" value="" id="inputString" />
</div>
<div class="suggestionsBox" id="suggestions" style="display: none;">
<div class="suggestionList" id="autoSuggestionsList">
</div>
</div>
</form>
</div>
On typing something suggestionsBox will show and populate with ajax results.
The returned html/php is appended to the SuggestionxBox:
'<li class="propid" id="'.$result['roomnumber'].'">'.$result['name'].'</li>';
Not sure why it doesn't alert when I click on an li element inside suggestionBox but if i use
$('.suggestionBox').click(function(){
alert($(this).find(li:first).attr('id'));
});
awesome answers everyone, but ive got with assigning an onclick event in html :)