heres the code for the index file
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title> tutorial</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
Search: <input id="search" type="text"/>
<div id="search_results">
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/search.js"></script>
</body>
</html>
heres my search.js file this is where I need Help. I need help figuring out what values go into the ” marks. Ive tried putting ‘search_results’ and ‘search’ in every combination but it just wont work. Im new to jquery so any help would be greatly appreciated. Thanks!
$('#search').keyup(function() {
var search_term = $(this).val();
$.post('php/search.php', { search_term: search_term }, function(data) {
$('#search_results').html(data);
$('').click(function(){
var result_value = $(this).text();
$('').val('', result_value);
$('').html('');
});
});
});
That depends upon how your result looks like. If you result contains something like this:
Then you click handler would change to this:
Demo: http://jsfiddle.net/Srj5Z/