0

I am relatively new learner of Javascript and specially Jquery.

It's kinda hard for me to understand the scope of "this" keyword along with Jquery.

Usually I console.log stuff to find my error/check value but I am not sure how to do it.

I am building real time live search for my webpage. I was referring to this code here

In this code, THey have used something like this:

//code missing HERE beginning of IF and ftn it is captured in 
 $(this).text().search(new RegExp(filter, "i")) < 0) {
     $(this).fadeOut();
     // Show the list item if the phrase matches and increase the count by 1
  } else {
     $(this).show();
     count++;
  }
}); //end of function

I am curious to know how can I debug this to know the value/text "this" is referring to here.

mcv
  • 1,232
  • 2
  • 16
  • 39
  • 1
    Debugging through console.log is inconvenient - open up the debugger tools in your browser (usually f12), go to the "source" tab, navigate to the code you want to debug and set a breakpoint by clicking to the left of the line you want to debug (usually). The browser gives you full information about all variables – Jakub Judas Apr 08 '18 at 14:05
  • your code snippet is incomplete. but this refers to the element that currently has an associated function which your snippet lacks. i edited your example. perhaps you can fill in the missing parts. – mcv Apr 08 '18 at 14:07

0 Answers0