5. Mark the current article: Code is accepted but clicks do nothing


#1

Code was working for previous lesson. Added in additional code which passes lesson. Looks correct to me (as a beginner lol) but clicking in the preview does nothing. Has syntax error of 'unterminated string literal' if that's any help? Thanks for reading.

var main = function () {
$('.article').click(function() {
$('.article').removeClass('current');
$('.description').hide();

    $(this).addclass('current);
    $(this).children('.description').show();
});

};
$(document).ready(main)


#2

Hey again Ryan :slightly_smiling:,

Take a look at this line, and see if you can find the two problems:

Hint

// ā†“ should be `addClass()`, with a capital ā€œCā€
addclass('current)
              // ā†‘ unclosed quote == your main problem


#3

Didn't close quote! Thanks!

The code no longer passes now though.

Getting the error message: 'Oops, try again. Add the line $(this).addClass('current'); inside your $('.article').click() function.'

Code the same, just with closed quote (i think) will re-paste here to be sure

var main = function () {
$('.article').click(function() {
$('.article').removeClass('current');
$('.description').hide();

  $(this).addclass('current');
  $(this).children('.description').show();

});

};
$(document).ready(main)


#4

@snitter There were two problems on that line; you only got one of them.
Look carefully at your capitalization of the addClass() function :wink:


#5

Oh wow :joy: Totally missed the capital. Thanks again!


#6

@snitter No problem, I'm always glad to help :slightly_smiling:


#7

had the same issue. thanks for the help snitter


#8

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