Guest User

Untitled

a guest
Apr 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.     var courses = []
  3.     $.ajax({
  4.           url: "/course/list/json",
  5.           context: document.body,
  6.           datatype: 'json',
  7.           success: function(json){
  8.             $.each(json.courses, function(key, val) {
  9.               courses.push(val)
  10.             });
  11.           }
  12.     });
  13.  
  14.   $('#course-add :text').change(function() {
  15.  
  16.   for(i=0; i<courses.length; i++) {
  17.     console.log("loopar")
  18.     if(courses[i]==$(this).val()) {
  19.       console.log("matchar")
  20.       $(this).addClass('red')
  21.     }  
  22.   }  
  23.   });
  24. });
Add Comment
Please, Sign In to add comment