What is "this" exactly?



first someone please tell me which HTML class two "this"s refer then please explain it a bit more !

var main = function() {
  $('.article').click(function() {


  $(document).keypress(function(event) {
    if(event.which === 111) {


    else if(event.which === 110) {
      var currentArticle = $('.current');
      var nextArticle = currentArticle.next();



Eg you have 10 div's with the class black an in jQuery you select the class black when clicked using this to make it hidden..

Using this will make only the div clicked hidden and not all ten div's with the class black..

If you were to use black then all ten will be hidden when clicked on only one.

So basically this checks which one was clicked and takes action on only that one


ok you mean in event handler "this" only refers to the class clicked ?




This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.