auto suggestion jquery to store the id

auto suggestion jquery to store the id

Dear sir

following code fills up the autosggest field and Click on name or selection
I want to store the id of the name selected in other filed so as to use it while storeing the details.

My html code

  1. <div class="label_div">Type Category</div>
  2.                         <input name="category1" type="text" id="category1" value="<?php echo $_POST['category1']; ?>" size="35"   onkeyup="categoryscript1()" />
  5.                           <div class="input_container">
  6.                             <ul id="categorylist1">
  7.                             </ul>
  8.                           </div>
  9.                           </div>
  10.                             <!-- content -->
  12.                           <!-- footer -->
  13.                       </div>


  1. function categoryscript1() {
         var min_length = 0; // min caracters to display the autocomplete
        var keyword = $('#category1').val();
        //var option =$('input[name=option]:checked').val();
        if (keyword.length >= min_length) {
                url: 'category1autofill.php',
                type: 'POST',
                data: {keyword:keyword},
        } else {

    // set_item : this function will be executed when we select an item

  2. function set_item1(item) {
        // change input value
        // hide proposition list

I want to store the id $rs['id'] or the id of the selected record  in afield so that I can use this id instead of name so as to save the record