0
$('.shortcode').removeClass('.shortcode');
$('.shortcode').hide();

Why .shortcode items gets hidden anyway? In source code they still have shortcode class.

0

2 Answers 2

11

Remove the dot '.'. This will work

$('.shortcode').removeClass('shortCode');
Sign up to request clarification or add additional context in comments.

1 Comment

Wow! Thank you so much! The freaking dot, I just killed an hour on this :)
5

You shouldn't use . in the string passed to removeClass: this...

$('.shortcode').removeClass('shortCode');

... is sufficient. Think of it: if method is intended to remove a class anyway, why should you mark its argument with the class sigil (.)? :)

With dot in front of the real className, jQuery tries to remove '.shortCode' class - obviously, it's a no-op here.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.