Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. var tagsElem = $("#tags");
  4.  
  5. tagsElem.autocomplete({
  6. source : "search.php",
  7. search : function( event, ui ){
  8. if(check(response,tagsElem.val()))
  9. response[response.length]=tagsElem.val()
  10. tagsElem.autocomplete( "option", "source", response);
  11. },
  12. open: function( event, ui ) {
  13. if(check(response,tagsElem.val())){
  14. tagsElem.next().find('li:last a').append(' <span style="color:red;">new</span>');
  15. }
  16. }
  17. });
  18.  
  19. function check(arrayTag,value){
  20. for(i=0;i<len;i++){
  21. if( arrayTag[i]==value)
  22. return false
  23. }
  24. return true
  25. }
  26.  
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement