Confused about step 3:Show A Description


#1

I am very confused about Step 3 of News Reader part of Interactive Website. I did as the instructions told me to and it wouldn't let me move on. I finally went into the hints and copy-pasted the code out of frustration, and it still wouldn't allow me to move ahead.
I tried everything, and nothing would let me move ahead until I put a . in front of this like so.

var main = function() {
$(document).ready(main);
$("article").click(function() {
$(.this).children('.description').show();
})
}

But when I clicked the article to pull down the description nothing happened.


#2

When written as above, this is an element type selector, and will target all <article></article> element nodes in the DOM. It should be written as a class selector...

$('.article')

this is a variable name, not a class name.

$(this)

The above line should be at the very end of your code, and not inside the main function body.

var main = function() {

};

$(document).ready(main);

If you are still having problems, please post a link to the exact exercise so we can test your (re-posted) code.


#3

mtf, I'm having almost the same problem. Here is my link

https://www.codecademy.com/en/courses/web-beginner-en-4hxyb/0/3?content_from=make-an-interactive-website%3Ajquery-events

Thank you for your help mtf.


#4

The code in the topic opener should work once corrected. Not sure what your problem is since we cannot see your code. The link takes us to our own work in that lesson (but is invaluable to include in a question).


#5

I'm sorry maybe it was my fault too, mtf. I'll upload screen shoot. I wrote this code

`var main = function() {
  $('.article').click(function() {
    $(this).children('description').show();
    
  });
};

$(document).ready(main);


#6

We need to tell the .children method the selector, so need to include the dot.

'.description`

We are targeting a child node that has a class="description" attribute.


#7

Thank you sooo much mtf.