code below for a simple auto suggest box... however when I click a suggestion from the list it doesn't return the contents to the input box like it should. It doesn't recognize anything from the loaded html at all?
JQUERY
$(document).ready(function(){
$('#edit-name').keyup(function() {
if ($(this).val().length >= 3) {
bname = $(this).val();
$("#searchframe").load("searchresults.php", { 'name[]': [name] });
} else {
$("#searchframe").html('');
}
});
$('.bus').click(function() {
alert("testing"); // <-- nothing happens!
$('#edit-name').val($(this).html());
});
});
HTML
...
<body>
...
<input type="text" id="edit-name" />
<div id="searchframe"></div>
...
</body>
...
INJECTED HTML
<ul>
<li><a href="#" class="bus">test1</a></li>
<li><a href="#" class="bus">test2</a></li>
</ul>