{"id":149,"date":"2011-11-12T19:09:17","date_gmt":"2011-11-13T00:09:17","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/carlita\/?p=149"},"modified":"2011-11-12T19:44:00","modified_gmt":"2011-11-13T00:44:00","slug":"jquery-autocomplete-links","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/carlita\/2011\/11\/12\/jquery-autocomplete-links\/","title":{"rendered":"JQuery autocomplete links"},"content":{"rendered":"<div>\n<p>=O suuper! si quieren que el autocomplete sea linkeable, agregar evento select e indicar enlace<\/p>\n<pre><code>$( \"#project\" ).autocomplete({\r\n  minLength: 0,\r\n  source: projects,\r\n<span style=\"color: #ff0000\"><strong>  <\/strong><strong>focus:<\/strong><\/span> function( event, ui ) {\r\n  $( \"#project\" ).val( ui.item.label );\r\n\treturn false;\r\n  },\r\n<strong><span style=\"color: #ff0000\">  <\/span><span style=\"color: #ff0000\">select:<\/span><\/strong> function( event, ui ) {<\/code><\/pre>\n<pre><code>  \/\/aqui todo codigo\u00a0<\/code><\/pre>\n<pre><code>  <span style=\"color: #ff0000\">\/\/ejemplo1  ---&gt;setear imagen u otros atributos de elementos<\/span>\r\n  $( \"#project\" ).val( ui.item.label );\r\n  $( \"#project-id\" ).val( ui.item.value );\r\n  $( \"#project-description\" ).html( ui.item.desc );\r\n  $( \"#project-icon\" ).attr( \"src\", \"images\/\" + ui.item.icon );<\/code><span style=\"font-family: monospace\">\u00a0<\/span><span style=\"color: #ff0000;font-family: monospace;line-height: 19px\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><\/pre>\n<pre><span style=\"font-family: monospace;color: #ff0000\"><span style=\"line-height: 19px\">\r\n<pre><code>  \/\/ejemplo2  ---&gt;setear imagen u otros atributos de elementos\r\n  window.location.href\u00a0=\u00a0ui.item.value;<\/code><\/pre>\n<p><\/span><\/span><\/p>\n<pre><code>  return false;\r\n  }\r\n  })\r\n<span style=\"color: #ff0000\">  <\/span><span style=\"color: #ff0000\">.data( \"autocomplete\" )._renderItem = function( ul, item ) {\r\n    return $( \"&lt;li&gt;&lt;\/li&gt;\" )\r\n    .data( \"item.autocomplete\", item )\r\n    .append( \"&lt;a&gt;\" + item.label + \"&lt;br&gt;\" + item.desc + \"&lt;\/a&gt;\" )\r\n    .appendTo( ul );\r\n  };<\/span><\/code><\/pre>\n<p><strong>Fuentes:<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/jqueryui.com\/demos\/autocomplete\/#custom-data\">http:\/\/jqueryui.com\/demos\/autocomplete\/#custom-data<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/4536055\/jquery-autocomplete-where-the-results-are-links\">http:\/\/stackoverflow.com\/questions\/4536055\/jquery-autocomplete-where-the-results-are-links<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>=O suuper! si quieren que el autocomplete sea linkeable, agregar evento select e indicar enlace $( \"#project\" ).autocomplete({ minLength: 0, source: projects, focus: function( event, ui ) { $( \"#project\" ).val( ui.item.label ); return false; }, select: function( event, ui ) { \/\/aqui todo codigo\u00a0 \/\/ejemplo1 ---&gt;setear imagen u otros atributos de elementos $( \"#project\" [&hellip;]<\/p>\n","protected":false},"author":3419,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[83958,3949,337,26146,83957],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-autocomplete","tag-jquery","tag-links","tag-menu","tag-ui"],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/users\/3419"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":11,"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":152,"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/posts\/149\/revisions\/152"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/carlita\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}