Page 1 of 1

How to hide all paragraphs at once?

PostPosted: Sun Jun 06, 2010 1:24 pm
by madasahatta
I've seen in the example css that you can hide paragraphs individually (hidden note class). This causes the paragraph to appear grey in the editor and to disappear in the preview.

I'm building an e-learning app and would like to be able to hide all paragraphs at once by clicking on an external button. This would not apply to any paragraph with the css class 'important' and would result in only highlighted notes appearing in the preview (highlighted notes are paragraphs marked important).

Is there a way of applying the hidden note class to all paragraphs at once?

thanks

Re: How to hide all paragraphs at once?

PostPosted: Sun Jun 06, 2010 2:33 pm
by mr_lundis
Untested, but should work:
Code: Select all
var wym = $.wymeditors(0);
jQuery('p:not(.important)', wym._doc).addClass('hidden');

Adjust the class names accordingly, and bam!

Cheers! ;)

Re: How to hide all paragraphs at once?

PostPosted: Sun Jun 06, 2010 5:15 pm
by madasahatta
Works great thanks.. :D .