English 中文(简体)
如何使用j Query 格式 项目、格式和格式
原标题:How to use jQuery s formatItem, formatMatch, and formatResult options for .autocomplete?

我正在利用“ j宝”的gin,我很赞赏一些援助形式,在案文写到投入领域时,在人口减少的菜单上显示结果。

为了获得有关数据,以便填满汽车,我从我的SQL公司利用这一PHP:

 $sql = (  SELECT tag, title, author, content, id FROM labels  );
 $result = mysql_query( $sql );
 $Response = array();
 while( $row = mysql_fetch_object( $result ) ){
 $Response[] = array(
                           "id" => $row->id,
                           "name" => $row->tag . ": " . $row->title . ": " . $row->content .""
                         );
 }

When a user selects the option from the autocomplete that is best for them, I convert the "name" above into the "id" using this method: var AllTagData = ; var Tags = [];

  for(var i in AllTagData){
     Tags.push(AllTagData[i].name);
  }

  function getIdFromTag(_name){
      for(var i in AllTagData){
          if(_name == AllTagData[i].name){
              return AllTagData[i].id;
          }
      }
  }

迄今为止,情况良好。 最后,我使用“ j基”板块,为用户提供数据:

$(document).ready(function(){
     $("#Responses").autocomplete({
         source: Tags,
         matchContains: true,
         autoFill: true,
         select: function(e, ui){
             $("#hidden_tags").val( getIdFromTags($("#Responses").val()) );
          }});
 });

守则的最后部分是,我需要帮助实施格式。 项目、格式和格式

从上述购买力平价中,我输出了“名称”中的塔格斯、标题和内容。 我为用户准备汽车包裹的方式是

  • Show Tags & Title
  • Hide Content
  • Search through Tags, Title, and Content for possible matches

因此,尽管我想要通过内容搜索汽车,但我不想在有人居住的汽车清单中显示内容。 我只想显示塔格斯和所有权。

I ve been having a lot of trouble with this and have searched quite extensively to find an answer and would really appreciate any help you can give on how to accomplish this. Please ask any follow up questions if you need further clarification. Thanks!

最佳回答

我认为,你正在使用不同的原始版本,但如果你看一看:

http://code.google.com/p/jquery-autocomplete/"rel=“nofollow”>http://code.google.com/p/jquery-autocomplete/

您将找到一份档案索引。

showResult: function(value, data) {
    return  <span style="color:red">  + value +  </span> ;
},

亲爱!

问题回答

暂无回答




相关问题
newbie jQuery plugin issue

I m just getting into jQuery plugins and I wanted to do a sort of hello world exercise with a barebones object-oriented plugin template. But I can t get the console.log statement in the setup() ...

Adding reverse highlighting to the jQuery image map plugin?

I m using the jQuery Map Hilighter plugin, but instead of fading a dark patch over each area, I would like to reverse this and instead make the surrounding area dark, keeping the hovered area the same ...

jQuery Address Plugin - Not allowing loading ajax?

I am trying to test the jQuery Address Plugin and it seems to not allow ajax to work in the change function. I am using: $.address.change(function(event) { $( #content ).load(event.value+ #...

JQuery validation plugin - error highlight problem

I have a form with two input textboxes, and I have included jQuery validation rules for both: <script src="../../Scripts/jquery-validate/jquery.validate.js" type="text/javascript"></script&...

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Impromptu plugin for Alert Boxes

When we use Javascript prompt Box something like this var ur_name = prompt("Enter Name"); We will have two types of values in this case: Value entered by user. Second VALUE can be NULL, when user ...

热门标签