Código Javascript:
Ver original
$(document).ready(function() { var start=/@/ig; var word=/@(\w+)/ig; $("#contentbox").keyup(function() { var content=$(this).val(); var go= content.match(start); var name= content.match(word); var dataString = 'searchword='+ name; if(go.length>0) { $("#msgbox").slideDown('show'); $("#display").slideUp('show'); $("#msgbox").html("Type the name of someone or something..."); if(name.length>0) { $.ajax({ type: "POST", url: "boxsearch.php", data: dataString, cache: false, success: function(html) { $("#msgbox").hide(); $("#display").html(html).show(); } }); } } return false(); }); $(".addname").click(function() { var username=$(this).attr('title'); var old=$("#contentbox").val(); var content=old.replace(word,""); $("#contentbox").val(content); var E=""+username+""; $("#contentbox").append(E); $("#display").hide(); $("#msgbox").hide(); $("#contentbox").focus(); }); });